On Wed, 17 Jul 2002 22:39:10 -0400, you wrote: >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 : >session_start(); >foreach ($HTTP_POST_VARS as $name=>$value) { >$name=$value; >session_register(name); //without the $ >} >and get nothing.
Assuming register_globals is off: session_start(); foreach ($HTTP_POST_VARS as $name => $value) { $$name = $value; session_register($name); } Remember, $name only contains the name of the variable, not a reference to the variable itself. To create a new global variable with the name "$name", you have to use a variable variable, hence $$name. Session_register, however, only requires a string which contains the name of the variable you want to register. $name will provide that by itself. In your example, by leaving off the dollar sign, you are referencing an undefined constant called "name"... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php