RE: [PHP] I don't understand HTTP_SESSION_VARS

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: RE: [PHP] I don't understand HTTP_SESSION_VARS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45622@lists.php.net to get a copy of this message
Hi Kirk, I'm not sure that's how it is supposed to work. I really think that this is a PHP bug. I had to turn register globals back on in order to get my code working again. I thought you're supposed to be able to simply declare a variable, do a session_register on it, and then access it on subsequent pages using $HTTP_SESSION_VARS. I'm going to keep register globals on for now I think. Thanks for your help! Mike > Mike, my experiments suggest you can also get rid of the session_register() > statement. Seems that simply assigning to $HTTP_SESSION_VARS[my_session_var] > is enough. > > Kirk > > > > -----Original Message----- > > From: Michael Champagne [mailto:mchampagne@capis.com] > > Subject: RE: [PHP] I don't understand HTTP_SESSION_VARS > > > > > > YES! That's what it was. You rule man. Why would > > session_start need to come > > before the global variable declaration? You'd think > > session_start would need > > $HTTP_SESSION_VARS declared beforehand to load the session > > variables into? > > > > Thanks, > > Mike > > > > > OK, try this. The session_start() has to come before the > > global statement: > > > > > > <?php > > > function write_session() > > > { > > > session_start(); > > > global $HTTP_SESSION_VARS; > > > $HTTP_SESSION_VARS[my_session_var] = "Boogedy Boogedy"; > > > session_register($HTTP_SESSION_VARS["my_session_var"]); > > > } > > > > > > write_session(); > > > echo $HTTP_SESSION_VARS['my_session_var']; > > > ?> > > -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: mchampagne@capis.com hm: mchamp@texas.net ****************************************************************** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ******************************************************************

« previous php.general (#45622) next »