On Wed, 2010-05-19 at 17:43 +0530, 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?

Before inserting the data, perform a query that asks for the count of
records with that data in it. If you get a record, then don't insert the
data. This assumes that the data in the row is always unique. If it's
something like adding a stats record, then have some sort of time
comparison against the current time and the date entry of the latest
matching record.


Reply via email to