[PHP] syntax for session_register();

2001-03-12 Thread stas

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!

stas






Re: [PHP] syntax for session_register();

2001-03-12 Thread stas

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." [EMAIL PROTECTED]



 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!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]