frames, session variables, and refresh

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hey all,
my index.html file has 2 frames.  one of the frames (left.php) sets a
php session variable (using a form).  this works as expected.  however,
when the user hits refresh on index.html, that session variable is
lost, even though the session id itself remains the exact same.  is
this the expected behavior?  if possible, how can i ensure the session
variable persists across the page refresh?  thanks!

Re: frames, session variables, and refresh

lost hope wrote:
Quoted text here. Click to load it


It may be that your PHP session id needs to be passed from the left
hand frame to the main frame and maybe the frameset itself.

I had a similar thing happen on my college project a year or so ago but
my memory is a bit hazy so please forgive me if I'm wrong on this.

Kind regards,


Re: frames, session variables, and refresh

Create the session variable in index page first(not in framed page)
cause that will not affect ur framed page and help to persist the
session_id. Then pass it to your frame page using session_id()

for example, your frame page url will be

<frame src=your_page_url?PHPSESSID=<?=session_id();?>

This will solve your problem.

NB: It may not be PHPSESSID in some cases, depending upon ur php.ini


Site Timeline