Re: Re: Need Help with register_globals OFF

From: Date: Sat, 03 Aug 2002 05:46:57 +0000
Subject: Re: Re: Need Help with register_globals OFF
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110937@lists.php.net to get a copy of this message
on 03/08/02 3:35 PM, Monty (monty3@hotmail.com) wrote: > Well, to answer my own question, I found a decent tutorial on using sessions > with the new register_globals off here: > > > http://www.wdvl.com/Authoring/Languages/PHP/Maintaining_state/session_variab > les.html > > 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. Justin Justin

« previous php.general (#110937) next »