Re: Unable to access the assigned session variable

From: Date: Mon, 21 Oct 2002 18:25:09 +0000
Subject: Re: Unable to access the assigned session variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120783@lists.php.net to get a copy of this message
> Hi : > I am new to Php, i am having some problem with session > in PHP > I am not sure what went wrong, I am using php4.2.3 > when i try to set session with following code > <?php > $os="BSD"; > session_register($os); > $name="devon"; > $devon="my Name"; > session_register($name); > ?> > > <?php > session_start(); > $user="dodell"; > if(session_register("user")){ > echo("User Field set to $user."); > } > else{ > echo("Coud not set the session variable"); > } > ?> > > it works well and it write the session value into > session file > ************ > user|s:6:"dodell"; > **************** > but when i try to access the same session variable > (used the following code) > > > <?php > session_start(); > echo("Welcome to the user area , $user"); Try echo("Welcome to the user area , {$_SESSION['user']}"); Do you know if you have register_globals ON or OFF in your php.ini? ---John Holmes...

« previous php.general (#120783) next »