note 51481 added to reserved.variables
| From: | shannonmoellerhasgmail at osu1 dot php dot net | Date: | Thu, 31 Mar 2005 21:29:18 +0000 |
| Subject: | note 51481 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87291@lists.php.net to get a copy of this message | ||
If you're ever in a situation where you need to get a query string variable and you can't
use a standard variable reference (inside a function, etc.) you can use the following:
<?
//example query: foo=bar&foo2=bar2
$rawquerystring = explode("&", $_SERVER["QUERY_STRING"]);
foreach($rawquerystring as $singlequery)
{
$queryparts = explode("=", $singlequery);
$querystring[$queryparts[0]] = $queryparts[1];
}
echo $querystring['foo']; //prints "bar"
echo $querystring['foo2']; //prints "bar2"
?>
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51481
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51481&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51481&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51481&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51481&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51481&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51481&report=yes
Search -- http://master.php.net/manage/user-notes.php