Re: Code Advice
| From: | Chris Wesley | Date: | Wed, 06 Nov 2002 19:37:25 +0000 |
| Subject: | Re: Code Advice | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123056@lists.php.net to get a copy of this message | ||
On Wed, 6 Nov 2002, Jason Young wrote:
> So then can anyone tell me why its working so far? ;)
It doesn't work at all like you want it to. I assume you've already put
this script up on a web server to test, so watch this:
After this line:
$$key = $val;
Insert this line for debugging:
echo $key . " --> " . $val . "<br>\n";
Then visit the script:
scriptname.php?foo=2&2=1
You've created something far worse than register globals.
Someone already posted a decent solution, something like this:
foreach( $get_allow as $get_key => $get_val ){
if( isset( $_GET[$get_val] ) ){
${$get_val} = $_GET[$get_val];
echo $get_val . " --> " . $_GET[$get_val] . "<br>\n";
}
}
g.luck,
~Chris