nine72 Posted January 2, 2009 Share Posted January 2, 2009 Hey everyone, Is it possible to unset and destroy a named session...example: $_SESSION['form_data'] ??? I have 23 named session states including my orginal login session ($_SESSION()) I need to unset and destory the other 22 with out loosing the login session. I know that I can unset the named session by unset($_SESSION['form_data']); Thanks in advance... Quote Link to comment Share on other sites More sharing options...
revraz Posted January 2, 2009 Share Posted January 2, 2009 Destroying the session does just that, then entire session. If you want to pick and choose which variable to unset, then you need to use unset. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2009 Share Posted January 2, 2009 session_destroy() just deletes the session data file. It has no effect on $_SESSION variables present in the script. When your script ends, any $_SESSION variables present will be written to the existing or new session data file. If you want to delete all session variables but one, I recommend saving that one variable in a program variable, clearing the $_SESSION variables using $_SESSION = array(); and then set your one session variable again from the program variable you set it to. Quote Link to comment Share on other sites More sharing options...
nine72 Posted January 2, 2009 Author Share Posted January 2, 2009 Thanks for the replies, I have just done a test and used unset only, and it worked kind of...one of my reusable form sets still retained the previous information but only in fire fox...weird... but I think that it will work out fine... Thanks again. How do i close this or mark it answered? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.