Error
If you are redirecting between 2 php pages and you have changed the session in page #1 and can't find the changes in page #2 do the following
Solution
Add exit(0) after the header("Location:page2.php")
Possible reasons
- If the header is in the middle of page #1 and no exit after it some parsing happens which may alter your changes before the next page
- The session is not persisted until the script has ended, which is not the case if there are some code after redirect line, that's why the "exit" is needed
check this relevant post: http://karim-ouda.blogspot.com/2013/01/empty-session-after-php-redirect-using.html
keywords: session_id session_start PHPSESSID session_name
Tweet
This comment has been removed by a blog administrator.
ReplyDelete