Hi,
Monday, January 13, 2003, 1:04:49 AM, you wrote:
WG> Hi,
WG> I have been trying to solve the problem of using session variables, but I
WG> have not had any luck. What I want to do is simple, I want to set my userid
WG> and password in a login screen and use it later (in another php form) to log
WG> into the database.
WG> In my login PHP file I have the following:
WG> if(isset($_POST['userid']) && isset($_POST['pword'])){
WG> $_SESSION['user'] = $_POST['userid'];
WG> $_SESSION['password'] = $_POST['pword'];
WG> }
WG> In my connect to database PHP file I have:
WG> if(isset($_SESSION['user'])){
WG> $user=$_SESSION['user'];
WG> echo "Print $user";
WG> }else{
WG> echo "Print Missing User";
WG> }
WG> The message I always get is "Print Missing User", so I must assume the
WG> global variable is not working. Can anyone help me out here?
WG> Thanks,
WG> Larry
Make sure you have session_start() at the begining of the second file.
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php