PDA

View Full Version : avoiding a double submit


songboy
09-30-2009, 09:51 PM
I've got a new account, a login and a user fill-in form working perfectly. However, I've got a knowledge problem to which I can't find an answer. When the user fills in the first part of the form (there are three parts), the data goes to mysql perfectly. The problem is that if the user clicks the submit button a second time a second row of the data is recorded in mysql. Obviously this could go on and on. Could someone explain how this double submit is prevented. PS once the submit is pressed the 'include' returns the same form page so that the second part of the form can be submitted. Now, to show I'm trying to think this through, is it a question of only having one submit on a form ?
Please give me some form of hint as things are going well until this blip.
Thanks -
Songboy

edbr
10-01-2009, 06:16 AM
its sounds like a wrong set up to me. if the first submit is an insert stament it will create a new record, if you then add more it will need to be processed with an update statement. so you coulld perhaps on first submit return a new form with action to an update statement, or maybe ( havent thought this throgh really) add a hiden fiels , fist part called sy inset second part update and on ypour action page have something like if $_POST[''insert] chose insert statement if update chose update statement