Re: syntax for session_register();

From: Date: Fri, 12 Jan 2001 17:00:55 +0000
Subject: Re: syntax for session_register();
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-43498@lists.php.net to get a copy of this message
Sean, as I said, I'm trying to accomplish this in a loop, and the variable is in array. To use your approach I would have to get rid of the loop and type out the code manually. This purpose of this is to create persistant form values in case form validation fails. Here's my code: <?php session_start(); while (list ($key, $val) = each ($form)) { if ($val) { session_register('$form_val[$val]'); $form_val[$val] = $val; echo "$form_val[$val]<br>"; echo "<a href=\"form.php\">test</a>"; } } ?> ----- Original Message ----- From: "Sean B." <osium@rio.bravo.net> > You were close: > session_register("varname"); > The key thing to remember is that it's the variable name WITHOUT the $. so... > $variable = "Hello"; > session_register("variable"); > > > > > Hello, > > > > What is the correct syntax for registering a variable that's a part of an > > array. I tried these variations (i'm doing this in a loop): > > > > session_register('$form_val[$val]'); > > > > session_register($form_val[$val]); > > > > This registers _something_, but not what I need. Thanks for any help!

« previous php.general (#43498) next »