Re: Unable to access the assigned session variable

From: Date: Mon, 21 Oct 2002 18:20:40 +0000
Subject: Re: Unable to access the assigned session variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120785@lists.php.net to get a copy of this message
Is register_globals OFF perhaps? Try.. echo "Welcome to the user area , ".$_SESSION['user']; -Kevin ----- Original Message ----- From: "ppf" <ppf2u@yahoo.com> To: <php-general@lists.php.net> Sent: Monday, October 21, 2002 12:10 PM Subject: [PHP] Unable to access the assigned session variable > > 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"); > ?> > > I am getting some error message > ******************************** > Notice: Undefined variable: user in > c:\projects\test\session2.php on line 3 > Welcome to the user area , > ****************************** > Can any one please specify what went wrong with my > code > Or should i need to make any chages in my php.ini > files etc.. > > when i run phpinfo(); > it out put shows that Session support enabled > Thanks in advance > Prad > > > __________________________________________________ > Do you Yahoo!? > Y! Web Hosting - Let the expert host your web site > http://webhosting.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#120785) next »