note 57497 deleted from reserved.variables by philip
| From: | philip@php.net | Date: | Wed, 21 Feb 2007 16:05:46 +0000 |
| Subject: | note 57497 deleted from reserved.variables by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123649@lists.php.net to get a copy of this message | ||
Note Submitter: webadmin at wibn dot net
----
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.