You are here: Re: Form submits the same record twice? « PHP SQL « IT news, forums, messages
Re: Form submits the same record twice?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация