hobotraveler Posted August 21, 2007 Share Posted August 21, 2007 Hi All, I've run into an issue with sessions. I create a session from a GET request like this: $_SESSION['categoryID'] = $_GET['categoryID']; What happens is that, when I open multiple browser windows/tabs from different categoryID's, the session variable gets overwritten with the newest value. Sessions allow me to validate stuff at the beginning and all is good later. I understand the concept of 1 session = 1 browser window/tab. If I open a category where the categoryID=1 and then open multiple windows or tabs where categoryID=2 and categoryID=3 etc then, the $_SESSION variable is = 3. Is there any possible way to tie the session to the newly opened browser window or tab. In this case, even if the user were to open new categories/windows, the older browser windows would still retain the session data. I am looking for ideas on how to handle this issue when multiple windows are opened. TIA Quote Link to comment https://forums.phpfreaks.com/topic/66019-store-mutiple-sessions-simultaneously/ Share on other sites More sharing options...
lemmin Posted August 21, 2007 Share Posted August 21, 2007 I believe you can use session_id() to change the current session. http://us2.php.net/manual/en/function.session-id.php Quote Link to comment https://forums.phpfreaks.com/topic/66019-store-mutiple-sessions-simultaneously/#findComment-330131 Share on other sites More sharing options...
hobotraveler Posted August 22, 2007 Author Share Posted August 22, 2007 Yes, but what about the previous session? Can I call the previous session through a GET? and call the $_SESSION vars from that session? How would this work? TIA Quote Link to comment https://forums.phpfreaks.com/topic/66019-store-mutiple-sessions-simultaneously/#findComment-330747 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 session_id() also returns the current session id. One thing you could do is, every time you make a new session, (when one already exists) save the current session id into the new session, then you can backtrack to whatever one you need. It might be sketchy for what you are trying to do, but I am not exactly sure what that is. Quote Link to comment https://forums.phpfreaks.com/topic/66019-store-mutiple-sessions-simultaneously/#findComment-331353 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.