|
Posted by J.O. Aho on 01/21/07 18:28
egibberate wrote:
>>> egibberate wrote
>
>>> Hi yet again,
>>> every time I click the refresh button on my
>>> browser another identical record to the last, is entered into the
>>> table even tho the form has nothing typed in the text boxes.
>> Most browsers when you hit refresh on a posted page popup a warning that
>> the data will be re-submitted. I'm surprised that your one doesn't.
>
> I've done some searching & it's normal behaviour for this to
> happen when the refresh button is used. Pretty bad show
> when credit card transactions are involved I shouldn't wonder.
> Seems I need to take steps to to prevent it. Thanks for response.
It's really a browser problem and not directly linked to PHP and even less to SQL.
What you can do is to have script split up in two, in the main file you have
the form, you submit the data to a secondary page, if the data stored to the
database goes as it should, it redirects with a header() the user back to the
form page, if something goes badly, the make an output from the secondary page.
This way when you do refresh on the form, the data won't be saved a second time.
--
//Aho
[Back to original message]
|