SESSION variable to pass login ID
| From: | Willie G | Date: | Sun, 12 Jan 2003 15:04:49 +0000 |
| Subject: | SESSION variable to pass login ID | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131338@lists.php.net to get a copy of this message | ||
Hi,
I have been trying to solve the problem of using session variables, but I
have not had any luck. What I want to do is simple, I want to set my userid
and password in a login screen and use it later (in another php form) to log
into the database.
In my login PHP file I have the following:
if(isset($_POST['userid']) && isset($_POST['pword'])){
$_SESSION['user'] = $_POST['userid'];
$_SESSION['password'] = $_POST['pword'];
}
In my connect to database PHP file I have:
if(isset($_SESSION['user'])){
$user=$_SESSION['user'];
echo "Print $user";
}else{
echo "Print Missing User";
}
The message I always get is "Print Missing User", so I must assume the
global variable is not working. Can anyone help me out here?
Thanks,
Larry