Jump to content

Unset session variable after a few seconds?


coupe-r

Recommended Posts

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
Share on other sites

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
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.