Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: which one to use and why ?
04-04-2007, 05:38 AM #1
- Join Date
- Dec 2005
- Thanked 0 Times in 0 Posts
which one to use and why ?
Hello forums !!
I had some few questions.
Suppose for passing the query string through url and retrieving it , i had seen the 2 ways.
$reqVar = '_' . $_SERVER['REQUEST_METHOD'];
$form_vars = $$reqVar;
$parm = $form_vars['parm'] ;
Thanks in advance to all of you.
04-04-2007, 06:20 AM #2
- Join Date
- Sep 2005
- Sydney, Australia
- Thanked 649 Times in 639 Posts
The second method loads a new array with all of the entries passed to the page in GET, POST and COOKIE fields providing more ways for people to break into your site and change things you don't want changed. You should avoid using $_REQUEST (which is what the first two statements of the second method uses and use specifically $_GET $_POST or $_COOKIE depending on which of the three you expect to contain the value rather than allowing it to be picked up from any of the three (with the potential for it to be overridden in one of the others).