RE: [PHP] How to use Session Variables

From: Date: Mon, 01 Jul 2002 23:31:43 +0000
Subject: RE: [PHP] How to use Session Variables
Groups: php.general 
Request: Send a blank email to php-general+get-104817@lists.php.net to get a copy of this message
With register_globals on: 1. Put session_start() at the top of each page. 2. Initialize the variable, then call session_register(): $foo = 'bar'; session_register('foo'); 3. Do all assignments to $foo, not $HTTP_SESSION_VAR['foo'], since $foo gets written to $HTTP_SESSION_VAR['foo'] at the end of the current page, and so will overwrite anything that was assigned to $HTTP_SESSION_VAR['foo']. 4. Because of #3, the value assigned to $foo won't be available in $HTTP_SESSION_VAR['foo'] until the next page. Clear as mud? I thought so ;) Kirk > -----Original Message----- > From: Brandon [mailto:brando@augmented-chaos.com] > Sent: Monday, July 01, 2002 4:02 PM > To: php-general@lists.php.net > Subject: [PHP] How to use Session Variables > > > Could anybody point me to a good tutorial/howto on how to > make a variable > accessible to all of my PHP pages? I'm running PHP 4.0.6 with > register_globals set to ON... (I cant change that). I've > tried with the > $HTTP_SESSION_VAR,$_SESSION, and session_register() method > but just can't > seem to make it work. Any help would be appreciated. > > Thanks, > Brandon > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#104817) next »