When the page refreshes, the data is reposted.  You basically need to be
able to track whether this is happening, or prevent it from easily
happening.

One easy solution is to send a header("Location: somewhere-safe.php")
after a successful post.  This way when the user hits refresh, it should
just refresh that safe page.  Theoretically they can still use their
back button and still give you the problem, but it will at least reduce
your problems in the interim if your application supports it.  You'll
have to store feedback in a session variable or otherwise keep it handy
for them, however.

Better would be to store a timestamp in a hidden field, and make that +
userid (or some other identifier that allows two different users to
submit simultaneously) a unique index in your database.  If they repost
the data, mysql will error because that combination is already in your
database.

You can obviously think of a million solutions - tracking sessions/pages
etc. - get creative to however will best fit or benefit your app!

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-----Original Message-----
From: Ganesh Babu Nallamothu, Integra-India
[mailto:[EMAIL PROTECTED] 
Sent: Monday, October 18, 2004 11:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Refreshing Problem 


Dear All,

First time I have entered the values to DB through form. If I refresh
once again one more time it is getting inserted. How to solve this
problem?


Ganesh

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

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

Reply via email to