Re: How to skip browser's Warning?
| From: | afan at afan dot net | Date: | Wed, 13 Sep 2006 17:10:50 +0000 |
| Subject: | Re: How to skip browser's Warning? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241743@lists.php.net to get a copy of this message | ||
Wouldn't this actually bring me back to empty form?
> On 9/13/06, afan@afan.net <afan@afan.net> wrote:
>>
>> sorry, but didn't get this one. could you please elaborate it a little
>> bi
>> to me?
>>
>> thanks.
>>
>>
>>
>> > On 9/13/06, afan@afan.net <afan@afan.net> wrote:
>> >>
>> >> Hi,
>> >> Could somebody explain to me what to do to skip this message I'm
>> getting
>> >> after I search for some products on my page, got the list of
>> products,
>> >> selected a detailed view of the product and click on the Back button
>> of
>> >> the browser to see again list of found products (result page):
>> >> "The Page you are trying to view contains POSTDATA that has expired
>> from
>> >> cache. If you resend the data, any action the form carried out such
>> as
>> a
>> >> search or online purchase) will be repeated. To resend the data,
>> click
>> >> OK.
>> >> Otherwise, click Cancel."
>> >>
>> >> Thanks for any help.
>> >>
>> >> -afan
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit:
>> >> http://www.php.net/unsub.php
>> >>
>> >> If you add a header redirect [header('Location:');] after your script
>> > processes the POST data you can avoid this.
>> >
>>
>> Sure..
>
> Say you have form.php. This page will post to process.php. (Just an
> example. Having form.php post to itself is fine too and how I always do
> my
> forms since on error I redisplay them with filled values)
>
> Inside process.php you might have something like
>
> <?php
> if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
> //do processing here
> if ( success ) {
> header('Location: )Ðð4&œ™$墽÷›
> %¦http://example.com/thanks.php');
> } else {
> header('Location:
> http://example.com/form.php');
> } // if
> } // if
>
> session_write_close(); // if you're using sessions
> exit();
> ?>
>
> Now when your form posts to process, your script will either go back to
> the
> form.php on error, or thanks.php on success. Because process.php issues a
> redirect, this tells the browser to ignore process.php in the history it
> saves. If a user clicks the back button it will go to form.php because
> process.php returned a 403 header and was "ignored" for lack of a better
> word.
>
> Hope that helps!
>