I'm having a problem with getting sessions to persist, and having no luck searching, I need to ask.
I can access the contents of my session as expected when first set, but as soon as the page refreshes I lose everything and I don't see why. session_start()
is set and I'm not unseting or destroying anything. I looked at PHP Info under sessions and everything looks ok (but my understanding of sessions is limited).
I'm running MAMP on OS 10.5, and the last time I used sessions they worked.
as Josh has said, you'll want to check for the sessions existence first before you start making a new one, use an if statement to check for the $_SESSION variable, that should give you the results you want. a lil debugging trick i use is to do this:
if($_SESSION) {
echo 'session exists';
else {
echo 'does not exist';
}
This way i know instantly what code block is being called, without worrying about whats contained inside.
Hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With