PDA

View Full Version : data enterd twice in database after refresh


maes
11-16-2002, 08:34 PM
Hi,

When I submit a form to be entered in my MySQL database and I press the refresh button, I get a dialog box asking me if I want to resend the information. If I say yes, the data is entered twice in my database. How can I prevent this?

thanks

-maes

mordred
11-16-2002, 08:42 PM
Use a session.

After submitting the first time and successfully entering the data in your database, you register a boolean variable as a session variable that serves as a persistent flag variable. So when you resend the data, you just check if the flag variable is already set. If that's the case (when you have already entered data), you just don't do anything, otherwise you can safely insert the data.

Makes sense?

maes
11-16-2002, 10:21 PM
that makes sence to me,

thank you :)