flash gordon Posted August 12, 2008 Share Posted August 12, 2008 Hi gang, Maybe I just don't understand enough php to google this correctly, but I can't find the answer. How do I make persistent session data between my pages? Here is what I'd like to do: session.php <?php session_start(); $_SESSION["name"]="bob"; echo $_SESSION["name"]; echo '<br><a href="session2.php">Next Page</a'; ?> session2.php <?php session_start(); echo $_SESSION["name"]; // should echo "bob" ?> Why doesn't the session data persistent between the pages? Cheers Link to comment https://forums.phpfreaks.com/topic/119323-solved-persistent-session-data/ Share on other sites More sharing options...
trq Posted August 12, 2008 Share Posted August 12, 2008 That should work fine. Are cookies enabled in your browser? Link to comment https://forums.phpfreaks.com/topic/119323-solved-persistent-session-data/#findComment-614668 Share on other sites More sharing options...
PFMaBiSmAd Posted August 12, 2008 Share Posted August 12, 2008 And add the following two lines immediately after your opening <?php tag in both pages - ini_set ("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/119323-solved-persistent-session-data/#findComment-614682 Share on other sites More sharing options...
flash gordon Posted August 12, 2008 Author Share Posted August 12, 2008 Thanks a bunch guys! By default I don't allow cookies to be stored on my browser. I had to turn them on and BAM! Thanks soooo much guys! Is this session data stored in a physical location on the server or is it stored in memory and clears automatically when the user closes his browser? Link to comment https://forums.phpfreaks.com/topic/119323-solved-persistent-session-data/#findComment-614773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.