note 29998 added to language.variables.variable
| From: | vrillusions at neo dot rr dot com | Date: | Mon, 03 Mar 2003 17:01:55 +0000 |
| Subject: | note 29998 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44788@lists.php.net to get a copy of this message | ||
Here is a very simple way of getting items from the $_POST superglobal into seperate variables. I
did this so I can easily print information in a form without having to worry about "this value
isn't set" messages. will create variables in the form $frm_nameInForm.
foreach($_POST as $key => $value) {
$varname = "frm_".$key;
$$varname = $value;
}
This uses foreach, so you need at least PHP 4 to do this. Although you can easily do it with a more
compatible while loop as well.
--
http://www.php.net/manual/en/language.variables.variable.php
http://master.php.net/manage/user-notes.php?action=edit+29998
http://master.php.net/manage/user-notes.php?action=delete+29998
http://master.php.net/manage/user-notes.php?action=reject+29998