Retrieving Session Variables

From: Date: Wed, 22 May 2002 01:38:27 +0000
Subject: Retrieving Session Variables
Groups: php.general 
Request: Send a blank email to php-general+get-98673@lists.php.net to get a copy of this message
I am having a problem getting a session variable in the function (currentlogin) below. I can process the script and in the else statement "print ($HTTP_SESSION_VARS['name']);" the session variable is printed but when the function tries to print the session variable, I get an error indicating an undefined variable. If someone could help me out I would appreaciate it. Is there a good tutorial on how to set and get session variables. From some of the snippets I have read in this news group there appears to be several ways to accomplish this. Thanks <?php if (isset($HTTP_SESSION_VARS['name'])==false){ writelogin(); } else { //Get logged in name and display message asking user if they would like to log out print ($HTTP_SESSION_VARS['name']); currentlogin(); } function currentlogin() { print ($HTTP_SESSION_VARS['name']); return; } ?>

« previous php.general (#98673) next »