coupe-r Posted February 13, 2011 Share Posted February 13, 2011 Hi All, When a user saves the page, I want to have the page refresh to show the new record and then have a message saying "Success!" or something like that. The only way I know how to do this is to set a session var after the record is created, but I would then need to unset it automatically so it doesn't keep showing. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/227553-unset-session-variable-after-a-few-seconds/ Share on other sites More sharing options...
ChemicalBliss Posted February 13, 2011 Share Posted February 13, 2011 What you said makes sense: Form Processor: // >> Check First If(isset($_SESSION['var'])){ unset($_SESSION['var']); echo("Success!"); } else{ // Do the editing $_SESSION['var'] = true; header(location: ...); } hope this helps Link to comment https://forums.phpfreaks.com/topic/227553-unset-session-variable-after-a-few-seconds/#findComment-1173758 Share on other sites More sharing options...
coupe-r Posted February 13, 2011 Author Share Posted February 13, 2011 Sweet. I thought there was something important I was missing. Works great. Thank you. Here is what I am using when an action is taken: $_SESSION['created'] = '<font size="3"><strong>Note Deleted!</strong></font>'; Here is the code at the top of the page: if(isset($_SESSION['created'])) { $created = $_SESSION['created']; unset($_SESSION['created']); } The reason I make $created, is because the session var is being unset and would never show up. Link to comment https://forums.phpfreaks.com/topic/227553-unset-session-variable-after-a-few-seconds/#findComment-1173760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.