The code that I have is as such: //header.php if(isset($_POST['login'])){ $checkuser = mysql_query("SELECT * FROM mainacct WHERE username = '{$_POST['username']}' AND password = '{$_POST['password']}' ", $connection) or die ("Couldn't find user."); if (mysql_num_rows($checkuser) > 0){ while ($row = mysql_fetch_array($checkuser)){ $_SESSION['UN'] = $row['username']; $_SESSION['UserLoggedIn'] = True; } } else { header("Location:login.php"); exit; } }
This file is then used as an include in main.php. As long as the variables are used ONLY in the header.php file, it works. But when I try to call the session variables in main.php, it doesn't show the values of UN or UserLoggedIn. session_start() is called in main.php. Is this a quirk with sessions, or is there something more I am supposed to be doing? Running Apache 2 w/PHP 4.2.3 on WindowsXP. Jami