Double insert?

Results 1 to 2 of 2

Thread: Double insert?

  1. #1
    Join Date
    Dec 1969

    Default Double insert?

    I have a page that recieves variables from a form, it simply inserts into a database. However, it seems to be looping itself and inserts two of the same forms. I do not have any sort of loop in the code or for- each statement. I posted this once before and someone gave me a quick little check code before inserting. Anyone help. Thanks

  2. #2
    Join Date
    Dec 1969

    Default Yes? So are you using...

    ...the "quick little check code"???<BR><BR>My first guess would be that the form is being submitted twice.<BR><BR>Easy way to test and prevent that:<BR><BR>&#060;SCRIPT Language="JavaScript"&#062;<BR>var submitted = false;<BR><BR>var testSubmit( )<BR>{<BR> if ( submitted )<BR> {<BR> alert("Already submitted...please be patient.");<BR> return false;<BR> }<BR> submitted = true;<BR> return true;<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>&#060;FORM ... onSubmit="return testSubmit( );"&#062;<BR><BR><BR>********<BR><BR>But you could also check server side.<BR><BR>&#060;%<BR>If Session("Submitted") = "Done" Then<BR> Response.Write "Already submitted, be patient."<BR> Response.End<BR>End If<BR><BR>Session("Submitted") = "Done"<BR><BR>... rest of your page ...<BR>%&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts