Refresh Problem

Victor Subervi victorsubervi at gmail.com
Mon Apr 12 09:37:14 EDT 2010


On Mon, Apr 12, 2010 at 9:03 AM, Victor Subervi <victorsubervi at gmail.com>wrote:

> On Sun, Apr 11, 2010 at 4:29 PM, Tim Chase <python.list at tim.thechases.com>wrote:
>
>> 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).
>>
>
> Man, I just forget this stuff. Dunno why. Yeah, just set a var in the URL
> of the post. Right. Sorry. Thanks.
> beno
>
> Correction. I was not familiar with Post/Redirect/Get. Thanks, Tim
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100412/b315fe17/attachment-0001.html>


More information about the Python-list mailing list