Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.