note 23233 deleted from install.windows by dams
| From: | dams@php.net | Date: | Sat, 27 Jul 2002 16:50:10 +0000 |
| Subject: | note 23233 deleted from install.windows by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33702@lists.php.net to get a copy of this message | ||
Here's a little snippet of code I have used with great success in all my windoze installs of
apache and php4.
I originally used an example from phpbuilder, but have modified it slightly to be a little clearer.
Hope this helps anyone who's stuck like I was trying to figure out why url variables
didn't work in windoze. ;)
// #######################################################
// The reason for the following two parsers is because windows sucks,
// and doesn't allow direct access
// to the variables declared from global namespace. Go figure.
//
//
// AUTOMATIC VARIABLES FROM $_POST PARSER ---- START
//
while ( list($post_key,$post_val) = each($_POST) )
{ $$post_key = $post_val; }
//
// AUTOMATIC VARIABLES FROM $_POST PARSER ---- END
//
//
// AUTOMATIC VARIABLES FROM URL PARSER ---- START
//
$url_string = $HTTP_SERVER_VARS['QUERY_STRING'];
if ( $url_string != "" )
{ $a = explode('&', $url_string); $i = 0;
while ($i < count($a))
{ $b = split('=', $a[$i]);
$url_variable = htmlspecialchars(urldecode($b[0]));
$$url_variable = htmlspecialchars(urldecode($b[1]));
$i++;
}
}
//
// AUTOMATIC VARIABLES FROM URL PARSER ---- END
//
// #######################################################