You are here: Re: Expiring $_POST variables « PHP Language « IT news, forums, messages
Re: Expiring $_POST variables

Posted by Michael Trausch on 10/02/75 11:25

Martin A. Weinberger wrote:
>
> I'm using a hidden button as shown in the following line to determine upon
> entry (or re-entry) to the PHP file, whether or not to process the form
> data.
>
> <input type="hidden" name="validateme" value="doit">
>
> The form contains anchor tags to link to other pages. From this point of
> view the form works perfectly. The problem is that, when the user goes back
> to this page later on, the "validateme" posted variable does not expire, so
> the form tries to reprocess the form, even though there is no form to show.
> My question is how can I reset the validateme to nothing (""), so that the
> user doesn't wind up reprocessing the page upon reentry at a later time.
>
> I'm accessing the validateme using the "$CmdDoIt = $_POST["validateme"];"
> line.
>
> Thanks in advance,
>

In theory, you could use JavaScript to protect it by detecting when the
"back" button is hit, and set the variable to a known bad value that you
can check against in the PHP script.

However, in practice, I wouldn't know how to do that, exactly. From
what I *do* understand of JavaScript, it's possible to "hook" buttons
like that, and I've seen it implemented in places before, though it's
been a little while since I've done that.

However, you still have to worry about some other scenerios, then. What
if the user has disabled JavaScript, or is still using a browser that
doesn't support it well or at all? (Hey, it's possible.)

I'm not sure about how you'd handle those particular questions.

- Mike

 

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

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