You are here: Re: [PHP] Clear POST variables on page refresh « PHP « IT news, forums, messages
Re: [PHP] Clear POST variables on page refresh

Posted by Richard Lynch on 10/04/62 11:07

Richard Morley wrote:
> I'm not sure if this is specifically a PHP problem, but here we go. Is
> there a way to clear the POST variables when the user refreshes a page?
> Specifically, my webpage POSTs a form to update or delete a record from
> the database -- it POSTs to itself, however. But if the user then clicks
> the browser's refresh button, it will try to delete or modify a
> non-existent record. I would like, if the users presses the refresh
> button, that PHP processes the page as no POST variables are set. I have a
> button on the page entitled "Reload" that executes a short Javascript:
> onclick=window.location=<? echo PHP_SELF; ?> which accomplishes the
> desired effect. But it tries to resend the POST information if the browser
> refresh button is clicked.

A simple thing to do is to put an md5 hash into the POST data, then only
do the insert if that md5 hash isn't already "used" when they hit refresh.

This avoids the hassle of re-direct headers and trying to follow
programming logic bouncing from script to script.

YMMV

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация