>Hello, I have captured variables from any HTML that is POSTed to me from a
>'foreach' clause. Now, possibly in this foreach clause I want to register
>these name/value pairs into a session var. I have tried :
>foreach ($HTTP_POST_VARS as $name=>$value) {
>session_register(name); //without the $
>and get nothing.

That's because you are registering 'name', which is to say $name, rather
that whatever is *inside* of $name...

Okay, the docs *DO* point out that you need to use the name of the variable
for session_register, not the varible itself, but $name *HOLDS* the name of
your variable.

In other words, consider this:

  $name = 'foo';
  $foo = 42;
  session_register('foo');  #RIGHT
  session_register($foo);   #WRONG
  session_register($name);  #RIGHT, same as session_register('foo') since
$name == 'foo'
  session_register('name'); #WRONG, that's registering $name, not $foo

Hope that makes sense.

Oh, and use error_reporting(E_ALL) to crank up your warning messages. 
You'll end up writing better code because of it.

Like Music?  http://l-i-e.com/artists.htm

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

Reply via email to