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