Re: Re: Need Help with register_globals OFF

From: Date: Sat, 03 Aug 2002 06:31:41 +0000
Subject: Re: Re: Need Help with register_globals OFF
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-110939@lists.php.net to get a copy of this message
Thanks for the tips, Justin. Sounds like a good idea. Do you, or anyone, know if the $_POST vars stay defined even after moving on to another page? Do I also need to unset $_POST after passing the vars each time? > From: justin@indent.com.au (Justin French) > Newsgroups: php.general > Date: Sat, 03 Aug 2002 15:46:57 +1000 > To: Monty <monty3@hotmail.com>, <php-general@lists.php.net> > Subject: Re: [PHP] Re: Need Help with register_globals OFF >> >> Anyone want to share any tips on how to deal with form vars passed to a >> script with register_globals turned off? Do you simply refer to them >> directly with $_GET['var'] or do you initialize vars locally that contain >> all the $_GET vars? > > Well I usually choose to POST forms, not GET them, but yeah, I just deal > with the vars as $_POST['var']. > > If I'm referencing the vars a LOT, I make regular $vars out of each element > in the POST array: > > $myvar = $_POST['myvar']; > > > If there's a lot of them, I do it with a foreach loop... something like: > > <? > foreach($_POST as $key => $value) > { > $$key = $value; > } > ?> > > ...will do the trick. It achieves the same as register_globals, but only > from one source, the POST array.

« previous php.general (#110939) next »