Re: Unable to access the assigned session variable
| From: | John Nichel | Date: | Mon, 21 Oct 2002 19:34:06 +0000 |
| Subject: | Re: Unable to access the assigned session variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120794@lists.php.net to get a copy of this message | ||
Also, you should call session_start before any other session function.
1LT John W. Holmes wrote:
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...