Jump to content

[SOLVED] Persistent session data


flash gordon

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.