sardonicgem Posted May 27, 2008 Share Posted May 27, 2008 Hey guys, I have a login page that stores the username in the SESSION array. My problem is that after I direct the user to another page (board.php), my SESSION array loses all it's values. I start the session in the beginning of login.php <?php session_start(); . . . //validate session $_SESSION['logged'] = true; $_SESSION['username'] = $in_name; . . ?> After the user logs in, he is directed to board.php <?php require_once("messageboard_functions.php"); echo "<html>"; do_html_header("Message Board"); echo "<body>"; do_html_heading("Message Board"); echo $_SESSION['username']; echo "</body></html>"; ?> Any ideas why my $_SESSION['username'] comes out empty?? Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted May 27, 2008 Share Posted May 27, 2008 put... session_start(); right at the very top of your php code in the board.php page Quote Link to comment Share on other sites More sharing options...
sardonicgem Posted May 27, 2008 Author Share Posted May 27, 2008 Awesome thanx. For some reason I thought it would override the initial SESSION if I called it on board.php Quote Link to comment Share on other sites More sharing options...
revraz Posted May 27, 2008 Share Posted May 27, 2008 Nope, creates a new one if one doesn't exist or resumes one if it exists. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.