Re: How to prevent duplicate record insertion after refreshing php page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Deva wrote:
Hi,

If I do refresh after submission of a form, records are getting stored
multiple times.
I have two pages. /submission-form/ and /thank-you/
I was trying header('Location: /thank-you/'); on submission-form page after
successful validation and insertion into db. Still if I do refresh on
thank-you page it adds one more record in database.
How to prevent it without token?

if you use POST for the form then the user agent should pop up a nice "do you want to send the data again" type dialogue box.

if you add a unique key over a few of the columns then this will prevent duplicates at the table level (regardless of the scenario).

to handle POST data, well no point me repeating it, see the spec:

http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-09#section-7.5

Best,

Nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux