Re: session variables

From: Date: Tue, 20 Apr 2004 16:44:27 +0000
Subject: Re: session variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184027@lists.php.net to get a copy of this message
* Thus wrote Charles Collins (sales@ayrmer.co.uk): > I have two test files running on a server, which is giving me a headache, > due to the fact the session variables are not been maintained across the two > pages. > > The server is running ... > > PHP Version = 4.0.5 > register_globals = ON > Session Support = Enabled This looks like output from 'php -i'. The php module *can* have a different config, check these values from phpinfo() in a webpage in the same directory as your scripts with > ... > > <? > session_start(); > session_register("test"); > $test = "Hullo World"; > print $test; // prints "test" > ?> > > Page # 2 > > <? > session_start(); > print $test; // prints nothing, zip! > ?> I would strongly suggest using the $_SESSION variable, even if register_globals is on, that way sessions work regardless of its setting. page 1: session_start(); $test = $_SESSION['test'] = 'Hullo World'; echo $test; page 2: session_start(); $test = $_SESSION['test']; echo $test; Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#184027) next »