From: MRAB on
Victor Subervi wrote:
> Hi;
> I send variables to a script. The script adds appropriate lines into a
> database of an order to my shopping cart. When I refresh the screen, as
> no doubt some customers will do, it re-ads those orders. Now, I can
> delete them, but that's not the point. I don't want it to re-ad the
> orders. How do I skirt this problem?
>
When you click on the Submit button on the form it should post the data,
ie use method="post", not method="get". If refreshing causes it to
re-submit, then you're using the wrong method. This is basic stuff.
From: Tim Chase on
On 04/11/2010 02:53 PM, MRAB wrote:
> Victor Subervi wrote:
>> Hi;
>> I send variables to a script. The script adds appropriate lines into a
>> database of an order to my shopping cart. When I refresh the screen, as
>> no doubt some customers will do, it re-ads those orders. Now, I can
>> delete them, but that's not the point. I don't want it to re-ad the
>> orders. How do I skirt this problem?
>>
> When you click on the Submit button on the form it should post the data,
> ie use method="post", not method="get". If refreshing causes it to
> re-submit, then you're using the wrong method. This is basic stuff.

And if you do POST your data (which you should if you're
attempting to change state on the server), you should use a
post/redirect/get pattern[1]. This will prevent the browser from
giving the "you've already submitted this data; do you want to
resubmit it?" message that most should give you if you refresh a
POST'ed page.

And therein demonstrates the need to know HTTP as mentioned in my
previous reply to you (VS, not MRAB).

-tkc

[1]
http://en.wikipedia.org/wiki/Post/Redirect/Get