note 57497 added to reserved.variables
| From: | webadmin at wibn dot net | Date: | Wed, 05 Oct 2005 21:55:47 +0000 |
| Subject: | note 57497 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96459@lists.php.net to get a copy of this message | ||
I like using the $_REQUEST variable because my scripts work as expected regardless of request method
and I can set per-user default values with cookies or session variables.
I was having problems because $_REQUEST was preferring cookie-method values over GET- and
POST-method values. I have no access to php.ini on my hosted web page and, of course,
ini_set("variables_order","ESCGP"); has no effect because $_REQUEST is created
before my script starts.
The following script fixed my problem:
foreach (array("_GET","_POST") as $source) {
foreach (${$source} as $idx => $value) {
$_REQUEST[$idx]=$value;
};
};
unset($source,$idx,$value);
Simply fill the array() with the names of the arrays you want to load into $_REQUEST, in increasing
order of preference.
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57497
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57497&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57497&report=yes
Search -- http://master.php.net/manage/user-notes.php