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
https://forums.phpfreaks.com/topic/134510-restore-value-of-variable-on-page-load/
Share on other sites

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.