note 29266 added to language.variables.variable
| From: | Dave at rack1 dot php dot net | Date: | Fri, 07 Feb 2003 18:40:07 +0000 |
| Subject: | note 29266 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43578@lists.php.net to get a copy of this message | ||
A lot of the php code out there relies on register_globals being set to "on" in the
php.ini -- which may not be an option for some developers. It seems that the following function
would attempt to overcome that issue for later versions of php. I haven't tried it out yet, as
I have no need for it right now -- and it may pose some of the same issues as if you had
register_globals set to "on" -- but here it is, anyway.
function getRequestVariables()
{
foreach ($_POST as $postKey => $postValue)
{
global $$postKey;
$$postKey = trim (stripslashes ($postValue));
}
foreach ($_GET as $getKey => $getValue)
{
global $$getKey;
if (empty($$getKey))
{
$$getKey = trim (stripslashes ($getValue));
}
}
}
--
http://www.php.net/manual/en/language.variables.variable.php
http://master.php.net/manage/user-notes.php?action=edit+29266
http://master.php.net/manage/user-notes.php?action=delete+29266
http://master.php.net/manage/user-notes.php?action=reject+29266