Re: session_is_registered

From: Date: Mon, 15 Apr 2002 13:00:13 +0000
Subject: Re: session_is_registered
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92989@lists.php.net to get a copy of this message
On Friday, April 12, 2002, at 07:01 PM, Norman Zhang wrote:
If I have register_globals=off, how do I pass session variables? I tried session_register("var1"). session_is_registered("var1") appears successful, but if I tried to echo the $var1". Nothing shows. How do I pass session variables?
Note that you do not need to use session_register() if you are using PHP4.1.x or greater, in fact you should not use session_register() IIRC. The new way to create or load a session variables is like so: <?php $_SESSION['foo'] = 'bar'; ?> It's that simple. Note that you don't need to use a string constant ('bar'), you could use another variable to make $_SESSION['foo'] refer to the same thing, as in: <?php $baz = 'bar'; $_SESSION['foo'] = $baz; ?> You can access this new session variable in the way you might expect, by using $_SESSION['foo']. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#92989) next »