There are two ways to do this. The easy way is to simply load any vars
passed via the URL or from a form as local vars in each script. So, I have
the following at the beginning of every script:
extract($_GET); // load vars passed via URL into local vars.
extract($_POST); // load vars passed via Forms into local vars.
If I pass ...?param=1 via the URL, then the extract($_GET) function will
automatically create a local var of the same name: $param
Or, you can access each variable directly. Say you pass the following via
In your script you can access the "param" var this way:
It's a pain to rejig all your scripts to work this new way, but, the
security benefits are worth it. Have a look here for more details...
> From: [EMAIL PROTECTED] (Gary)
> Newsgroups: php.general
> Date: Mon, 14 Oct 2002 15:07:21 -0400
> To: [EMAIL PROTECTED]
> Subject: Pass vars in URL
> My host has upgraded to 4.2 but still uses the old ini setting. I am
> trying to rewrite my scripts so when the day comes for my host to make
> the change I will be ready. Everything has been going well till now. I
> have been passing an id through a url string. Now when I try to pass the
> id it show up in the url but does nothing. If i check if it is
> set, it is not. IT is supposed to pass the id number to mysql on the
> linked page. I there something I am missing some new way or do I need to
> turn on something in the ini?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php