Jump to content

Restore value of variable on page load


kannu

Recommended Posts

hello,

I have a Session variable, where value is stored based on user selection. However, I want to restore the value of the variable to a default value, everytime the user loads the page again (such as refreshing the page, or by hitting the back/forward button on his browser). Therefore each time the page is loaded again, I want to restore the value of session variable to a default value.

 

How can I do this, if someone can please help me out.

thanks

 

ps: I have already tried following which has not worked:

I tried  $_SESSION['passMe']= some default value; as the first line inside the <body> tag, thinking the the session variable value would be restored to default value each time the page loads again, but this does not happen. the variable value is not restored, and it retains the user selection.

 

 

Link to comment
Share on other sites

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.