on 03/08/02 3:35 PM, Monty ([EMAIL PROTECTED]) 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to