|
Posted by Jerry Stuckle on 11/14/06 12:23
Shelly wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:EJSdnWsIGMcLqcTYnZ2dnUVZ_r-dnZ2d@comcast.com...
>
>>Shelly wrote:
>>
>>>I have the following for a test of the submit button being pressed:
>>>
>>>if (isset($_POST['theSubmitButton'])) {
>>>
>>>This works fine and I have been doing this for a long time. Here is the
>>>question:
>>>
>>>If I do a submit and have it come back to the same page, all is fine. If
>>>I now click the browser refresh button, I get another submittal. How do
>>>I "unset" the status so that it doesn't think I clicked the submit button
>>>when I click the refresh button?
>>>
>>>Shelly
>>>
>>>
>>
>>You can't just unset a $_POST variable (well, you can, but it won't work
>>like you want). When your user hits reload on the browser, the browser
>>will resend the post, setting it again.
>>
>>You can, for instance, have the submit button go to another page to
>>process the data, then redirect back to your original page with a header()
>>call.
>
>
> I already tried something like this just after I submitted the original
> post. I had the original submit button force the processing of the post and
> at the end of that processing it was sent to another page, pageRedir.php,
> via a header. In pageRedir.php I had it go immediately via a header back to
> the original page. A refresh of that original page then still resulted in
> another processing.
>
> Anyway, a refresh would still satisfy the isset for the submit button so it
> would still be sent to another page. I don't see how this gains anything.
>
That's because you didn't do it like I described. You must have a
DIFFERENT page doing the processing. You can then redirect back to the
original page, if you wish.
>
>>You can also set a value in the $_SESSION to indicate the page was
>>submitted; you just need to ensure you have a way of unsetting it once
>>they leave that page.
>
>
> I thought of this too, but didn't see how I could guarantee an unsetting of
> the session variable. There are so many ways to leave a page :-). So, I
> abandoned this line of thought.
>
Or if you have a page leading up it this one, reset it there. For
instance, if this is a confirmation page, you can reset the bit on the
original page where the data was entered.
>
>>There are other ways - but these are the two I use most often.
>
>
>
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|