Jump to content

Store Mutiple Sessions Simultaneously?


hobotraveler

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/66019-store-mutiple-sessions-simultaneously/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.