RE: [PHP] Clearing POST variable on page refresh
| From: | Brad Fuller | Date: | Mon, 18 Dec 2006 14:34:04 +0000 |
| Subject: | RE: [PHP] Clearing POST variable on page refresh | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245951@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jochem Maas [mailto:jochem@iamjochem.com]
> Sent: Monday, December 18, 2006 3:39 AM
> To: Beauford
> Cc: PHP
> Subject: Re: [PHP] Clearing POST variable on page refresh
>
> Beauford wrote:
> > Hi,
> >
> > I have a page with a form on it which posts to itself. The problem is
> when
> > someone refreshes the page it enters the data into the DB again. How do
> I
> > clear these variables so that doesn't happen. I tried the unset
> function,
> > but no luck. I really don't want to use sessions or cookies as this is
> just
> > a simple little page, but still, it has to work right.
>
> sessions are no big deal - search the list archive for stuff like 'form
> token'
> until you find one of the many explainations of how to tackle this issue
> using
> a 'one time' token concept (find the posts by Richard Lynch - they are the
> most
> complete/abundant/explicit AFAICR) - the solution does use sessions, but
> like I
> said thats not a big deal at all. :-)
>
> >
> > Thanks
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
My way of getting around this has been to put the data manipulation into a
"process" page, which redirects back to the content page when its finished
processing. That way, when the user hits refresh it doesn't ask to resubmit
the data. It just refreshes the display.