Do a seek on the fields which cannot be duplicated; if there's a hit reload the page with the appropriate error message, otherwise reload the page with a success message.
Although I have not worked with AJAX, this would appear to be an excellent spot to use it. Silently check after focus has left the final field which must be unique, doing nothing if data is OK, putting up a flag if there was duplication.
As for a unique ID for each record, i.e. one that autoincrements, that's almost always a good idea.
Regards - Miles Thompson At 07:17 AM 7/30/2005, Hallvard wrote:
I have a page that posts data from a form to a mysql database. The problem is that if the user hits the reload button on the browser, the data will be posted again, resulting in a duplicate record. How can I avoid that? -- 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