This statement doesnt look right to me. if(isset($_POST['userid']) && isset($_POST['pword'])){ $_SESSION['user'] = $_POST['userid']; $_SESSION['password'] = $_POST['pword']; }
the if should be: if ((statement)&&(statement)) { } so: if ((isset($_POST['userid'])) && (isset($_POST['pword']))) { $_SESSION['user'] = $_POST['userid']; $_SESSION['password'] = $_POST['pword']; } That should work. "Willie G" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Tom, > > I do have a session_start() in both files, but it does not seem to help. > > - Larry > > -----Original Message----- > From: Tom Rogers [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 12, 2003 11:36 AM > To: Willie G > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] SESSION variable to pass login ID > > > 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 > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php