PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
After finally being able to store variables in a session, now I can't seem to be able to delete them!
Right after I use the session_unregister or session_unset functions, the variable does get deleted from the session (or so it seems), but if I reload a page, the variable re-appears.
Do I need to do something special besides _unregister or _unset?
gxpark wrote:but if I reload a page, the variable re-appears.
Well, this would mean that somewhere on the page you are also giving the $_SESSION variable a value. So look for a line where you would be giving the variable a value and that's why it's setting it again.
I don't think that's the problem since setting the $_SESSION array elements directly does not work (that's what I was doing in the first place, now I know better).
I'm using the newest version of PHP, and setting the $_SESSION array directly does not work for me. It does store the value for as long as the script is running, but not between pages (in the same session).
I'm using session_start, and my session data is indeed being saved. As for your other comment, well, then there must be something wrong with my installation because what you suggest does not work.