note 51481 deleted from reserved.variables by philip
| From: | philip@php.net | Date: | Fri, 22 Apr 2005 19:41:13 +0000 |
| Subject: | note 51481 deleted from reserved.variables by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88418@lists.php.net to get a copy of this message | ||
Note Submitter: shannonmoeller has gmail
----
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"
?>