Click to See Complete Forum and Search --> : Dublicate records being created


Rye13
11-08-2003, 04:04 PM
We are experiencing a problem on our site as follows:

We have a form that creates a record in our database (using ASP). The problem is that once the form has been submitted, if the user goes "BACK" to the form again, and then submits again -- a 2nd record is created. So now the user has 2 records the same (or with minor differences if they changed a few things). We'd prefer our site to react in such a manner that if the user goes "Back" and then submits again -- the orginal record gets overwritten by the new one, so the user only has 1 updated record.

Any tricks or suggestions on how to go about this?? :confused:

Thanks -- Rye13

PeOfEo
11-09-2003, 12:11 AM
Make a separate update form and then put a time into the user data base and do not let the user post again for like 30 seconds to prevent accidental double clicks and reposts. You cannot just over incert something in a data base, you would get a nasty error message. You can update but you would need to have a vlue there to begin with.

jyazell
12-02-2003, 10:12 AM
If you are using C#, you can add an if statement to the page load that will check to see if the page is being posted for a second time.

if(!IsPostBack)
{
Add coding for initial page load
}
else
{
Add coding if they are coming back to the page.
}

PeOfEo
12-02-2003, 06:19 PM
but... this isnt c# the question was about asp classic, which is vbscript or javascript... pain in the butt to use those isnt it?