kannu Posted November 27, 2008 Share Posted November 27, 2008 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 More sharing options...
Schlo_50 Posted November 27, 2008 Share Posted November 27, 2008 When you've finished using your session you could un set it. unset($_SESSION['variableName']); Link to comment https://forums.phpfreaks.com/topic/134510-restore-value-of-variable-on-page-load/#findComment-700383 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.