I did something pretty similar to this but not with an MD5 hash. I used a table which had just two fields, one autoincrement and another one a boolean. When doing a form, I added one record to this table and the ID I got from it is the one I sent in the form, the other field served to indicate that the ID had been used, as you mention. Later on I read about redirecting out of the update page, as Marek Kilimajer replied above and never bothered to do it again. Satyam "Richard Lynch" <ceo@xxxxxxxxx> wrote in message news:36963.67.184.124.249.1116394794.squirrel@xxxxxxxxxxxxxxxx > On Tue, May 17, 2005 2:24 pm, Robert Meyer said: >> Hello, >> >> Scenario: >> 1) User is presented a blank form. > > with an MD5 hash which is stored in the database as "fresh" > >> 2) User fills in form. >> 3) User submits form. >> 4) Record is added to database. > > That particular MD5 has is marked as "used" > >> 5) Back to 1). >> All is fine to here. >> 6) User clicks refresh. >> 7) Another record is added, same data except auto-increment field. >> How do I prevent these last two steps, or at least prevent a record >> from being added when refresh is clicked? > > The used MD5 hash tells you they are re-submitting the exact same form. > > Now, if the real problem is that the user has a fresh new form, and fills > in the same data again by hand, then there are only two possibilities: > > 1. In the real world, they actually NEED two of the "same" thing in the > database, and your application should allow it. > > 2. In the real world, users are likely to lose track of where they are in > their data entry, and you need to provide them the context to help avoid > that. When you go back to 1) present a message like "added blah blah blah" > at the top of the screen. Now they *KNOW* they just did blah blah blah, > and can move on to blah blah bleh. Data entry is a sucky job. Make it > nicer for them, eh? You STILL need to code for the dual entry, and do > something intelligent when they mess up, but you can improve efficiency > and decrease errors (where 2 not-quite-the-same-but-really-are-the-same > entries pass your tests) if you make your application nicer to the user. > > -- > Like Music? > http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php