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?? Link to comment https://forums.phpfreaks.com/topic/107472-solved-hopefully-a-simple-session-question/ 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 Link to comment https://forums.phpfreaks.com/topic/107472-solved-hopefully-a-simple-session-question/#findComment-550865 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 Link to comment https://forums.phpfreaks.com/topic/107472-solved-hopefully-a-simple-session-question/#findComment-550871 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. Link to comment https://forums.phpfreaks.com/topic/107472-solved-hopefully-a-simple-session-question/#findComment-550873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.