December 4th, 2012, 01:45 PM
[SOLVED] I am failing at sessions please help.
I want to pass along some data from one page to the next, without the user seeing it(so without GET).
I decided to use sessions for it, if there is a better solution I'd be glad to hear about it.
The problem is that the data I add to the session on the first page, is not available on the second.
Here is a minimal working example:
$_SESSION['test'] = "data";
Probably I am understanding the whole sessions thing all wrong.
<html><body><?php echo $_SESSION['test']; ?></body></html>
So, what do I do wrong and/or how should I do it otherwise?
Thanks in advance!
Last edited by Oebele; December 4th, 2012 at 01:57 PM.
Reason: Problem solved
December 4th, 2012, 01:54 PM
It looks to me like you are missing a 'session_start' on page2.php.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
December 4th, 2012, 01:57 PM
That indeed fixed it. I did not read that in any of the tutorials I read...
Must be the quickest solved problem on a forum I ever encountered, thanks!