SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: random error

  1. #1
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    random error

    Hi,

    I have created a simple booking form.

    Everything works fine - but a few customers emailed me saying they received an error when they clicked submit. I have thoroughly tested the form and even sumitted the same details some customers entered and did not get any errors.

    Could this be because of the traffic on the website? (there have been hundreds of bookings within a few days)

    This is the error message: -

    This was the error message the received:-
    Microsoft OLE DB Provider for SQL Server error '80040e14'
    Incorrect syntax near 'm'.
    /marketing.asp, line 24


    line 24 is:-
    Code:
    conn.execute(SQLTemp)
    the line before that is:-

    Code:
    SQLTemp = "INSERT INTO booking (firstname, surname, email, phone, gender, company_name, address1, address2, address3, town, postcode) values ('" & firstname & "','" & surname & "','" & email & "','" & phone & "','" & gender & "','" & company_name & "','" & address1 & "','" & address2 & "','" & address3 & "','" & town & "','" & postcode & "'')"
    I am so certain I have no errors in my script. I am still getting bookings by most people just the odd few receive the error message.

    Can anyone tell me why this is happening and what I can do? Maybe have a redirect page with a message saying 'please try again in a few minutes'

    Hope someone can help!

    Thanks in advance

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in your INSERT statement, the stuff after "postcode" does not look valid.

  3. #3
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh yea! Thanks for that! well spotted... but do you know why it worked for most people and not for some?

    Also I have come across another problem. When the form submits the record is saved into the database and also an email is sent to me with the data. For some reason I recieve the email more than once and the data also gets saved into the database more than once.

    I thought this maybe because the user clicks on submit several times so I thought about disabling the submit button. After the form is validated and the user clicks submit the button dissappears and a message appears 'form processing please wait'

    this has not solved the duplicate data entry and I recieve the same email more than once. This (like my other problem) is not a consistant problem and does not happen with all users. If the problem happened to everyone I could get to the bottom of it!

    I tried to replicate the duplicate data entry problem and cannot figure out how people submit the form more than once. Also what was weird was there was an 8 minute difference when I received the same email (hope that makes sense!)

    Any ideas? really hope you can help!

  4. #4
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just double checked the invalid code you pointed out... I must have accidently typed in when I typed the code here.... the code is correct: -

    Code:
    " & postcode & "')"
    any ideas as to what it can be?... that was a typo by me on here

  5. #5
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't tell you anything about your problem as there is obviously no code to look at.

    Try to narrow down the problem and post error messages or some type of specifics.

  6. #6
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Everything seems to be working fine my end so I am finding it difficult to narrow down the problem. The error I posted above was sent to me by a user and I can't replicate their error. I have even tried the form on different machines and have had no problems.

    Here is the code - I've been over it and cannot spot anything that is causing the error and random duplicate entries.

    Here is the form: -

    Code:
     <form id="form1" name="form1" method="get" action="marketing.asp" onsubmit="this.submit.value = 'Submitting...'; document.getElementById('processing').value='please wait your form is being processed'; classChange('buttonSubmitHide',submit);   return true; ">
    
        <table width="80%" align="center" cellpadding="10" bgcolor="#b4cfe4">
    
      <tr>
        <td>
      <table width="100%" align="center" cellpadding="0" bgcolor="#b4cfe4">
      <tr>
        <td><p><strong>Event date and venue</strong></p></td>
      </tr>
    </table><input name="map" type="hidden" id="map" value="None" /><input name="venuenumber" type="hidden" id="venuenumber" value="None" />
        <label><span class="venuedate"><input type="radio" value="13/7/2010 - Wolverhampton Race Course, Dunstall Park, Gorsebrook Road, Wolverhampton, WV6 0PE" name="events"onclick="document.getElementById('map').value='http://www.wolverhampton-racecourse.co.uk/assets/_files/documents/oct_06/al__1162315410_WolverhamptonRacecourse_Col.pdf';" onmousedown="document.getElementById('venuenumber').value='01902 390000';"/>13/7/2010 - Wolverhampton Race Course, Dunstall Park, Gorsebrook Road, Wolverhampton, WV6 0PE</span></label><br />
    
    
    <label><span class="venuedate"><input type="radio" value="21/7/2010 - Longbridge Technology Park, Two Devon Way, Birmingham, B31 2TS" name="events" onclick= "document.getElementById('map').value='http://www.longbridgebirmingham.co.uk/technology-park/location.php';" onmousedown="document.getElementById('venuenumber').value='0121 222 5555';"/> 21/7/2010 - Longbridge Technology Park, Two Devon Way, Birmingham, B31 2TS</span></label><br />
    
    
    <label><span class="venuedate"><input type="radio" value="22/07/2010 - Coventry & Warwickshire Chamber of Commerce, Oak Tree Court, Binley Business Park, Harry Weston Road, Coventry, CV3 2UN" name=r1 disabled onclick= "document.getElementById('map').value='http://www.cw-oaktree.co.uk/findus.htm';" onmousedown="document.getElementById('venuenumber').value='02476 6543247';"/>
    <span class="red">Event full</span> 22/07/2010 - Coventry &amp; Warwickshire Chamber of Commerce, Oak Tree Court, Binley Business Park, Harry Weston Road, Coventry, CV3 2UN</span></label><br />
    
    
    <label><span class="venuedate"><input type="radio" value="24/8/2010 - Worcester Rugby Club (Duckworth Suite), Sixways Stadium, Warriors Way, Worcestershire, WR3 8ZE " name="events" onclick= "document.getElementById('map').value='http://www.warriors.co.uk/club/gettinghere.php';" onmousedown="document.getElementById('venuenumber').value='01905 454183';"/>24/8/2010 - Worcester Rugby Club (Duckworth Suite), Sixways Stadium, Warriors Way, Worcestershire, WR3 8ZE </span></label><br />
    
    <label><span class="venuedate"><input type="radio" value="15/9/2010 - Yarnfield Park Training & Conference Centre, Yarnfield Lane, Yarnfield, Staffs, ST15 0NL" name="events" onclick= "document.getElementById('map').value='http://www.yarnfieldpark.com/contact_us.htm';" onmousedown="document.getElementById('venuenumber').value='01785 762444';"/>
    15/9/2010 - Yarnfield Park Training &amp; Conference Centre, Yarnfield Lane, Yarnfield, Staffs, ST15 0NL</span></label><br />
    
    <label><span class="venuedate"><input type="radio" value="21/9/2010 - Shropshire Chamber of Commerce, Trevithick House, Stafford Park, Telford, Shropshire, TF3 3BA" name="events"  onclick="document.getElementById('map').value='http://www.shropshire-chamber.co.uk/contact-us.html';" onmousedown="document.getElementById('venuenumber').value='01952 208200';"/>
    21/9/2010 - Shropshire Chamber of Commerce, Trevithick House, Stafford Park, Telford, Shropshire, TF3 3BA</span></label><br />
    <p><strong>Please note : Only 2 people per business will be accepted on to this workshop.</strong></p>
    
        </td>
      </tr>
    </table>
    
    
    
    
    <table width=80% align="center" cellpadding="5" bgcolor="#699fcb">
            <tr>
              <td colspan="4" valign="bottom"><p class="bluetxt"><span class="red2">*</span> these fields are mandatory</p></td>
            </tr>
            <tr>
              <td width="24%" align="right" valign="bottom"><label>Salutation <span class="red2">*</span></label></td>
              <td width="28%" valign="bottom"><select name="salutation" size=1 tabindex=1 >
                <option>Please select...</option>
                <option value="Dr">Dr</option>
                <option value="Miss">Miss</option>
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Ms">Ms</option>
              </select></td>
              <td width="20%" align="right" valign="bottom"><label>Company Name <span class="red2">*</span></label></td>
              <td width="28%" valign="bottom"><input class="fields" type="text" name="company_name" id="company_name" /></td>
            </tr>
            <tr>
              <td align="right"><label>Firstname <span class="red2">*</span> </label></td>
              <td><input name="firstname" type="text" class="fields" id="firstname" tabindex=2 /></td>
              <td align="right"><label>Business start date</label></td>
              <td><input class="fields" type="text" name="business_start_date" id="business_start_date" /></td>
            </tr>
            <tr>
              <td align="right"><label>Surname <span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="surname" id="surname" tabindex=3 /></td>
              <td align="right"><label>Nature of business <span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="business" id="business" /></td>
            </tr>
            <tr>
              <td align="right"><label>Email Address <span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="email" id="email" tabindex=4 /></td>
     		  <td align="right"><label>Address line 1 <span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="address1" id="address1" /></td>
            </tr>
            <tr>
              <td align="right"><label>Phone Number <span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="phone" id="phone" tabindex=5 /></td>
              <td align="right"><label>Address line 2</label></td>
              <td><input class="fields" type="text" name="address2" id="address2" /></td>
            </tr>
            <tr>
              <td align="right"><label>Majority ownership gender</label></td>
              <td><select class="fields" name="gender" id="gender" tabindex=6 >
                <option value="decline to say">Declined to say</option>
                <option value="Female">Female</option>
                <option value="Male">Male</option>
                <option value="No clear majority">No Clear Majority</option>
              </select></td>
              <td align="right"><label>Address line 3</label></td>
              <td><input class="fields" type="text" name="Address3" id="Address3" /></td>
            </tr>
            <tr>
              <td align="right"><label>Majority ownership ethnicity</label></td>
              <td><select class="fields" name="ethnicity" id="ethnicity" tabindex=7 >
                <option>Please Select</option>
                <option value="Asian - Indian">Asian - Indian</option>
                <option value="Asian - Other">Asian - Other Asian Background</option>
                <option value="Asian - Pakistani">Asian - Pakistani</option>
                <option value="Black - African">Black - African</option>
                <option value="Black - Carribean">Black - Carribean</option>
                <option value="Black - Other">Black - Other Black Background</option>
                <option value="Mixed  - Other">Mixed  - Other Mixed Background</option>
                <option value="Mixed - White and Asian">Mixed - White and Asian</option>
    
                <option value="Other, Chinese">Other, Chinese</option>
                <option value="Any Other Ethnic Group">Any Other Ethnic Group</option>
                <option value=" White Background">White - Other White Background</option>
              </select></td>
              <td align="right"><label>Town*<span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="Town" id="Town" /></td>
            </tr>
            <tr>
              <td align="right"></td>
              <td>&nbsp;</td>
              <td align="right"><label>Postcode*<span class="red2">*</span></label></td>
              <td><input class="fields" type="text" name="Postcode" id="Postcode" /></td>
            </tr>
            <tr>
              <td colspan="4">
               
              
              <label>Do you wish to bring a colleague? 
    <input type="radio" value="show" onclick="showdivDisplay()"/> yes</label>
    
            </td>
            </tr>
          </table>
    
    
     <div id = "addperson" style="display:none">
    
    <table width="80%" align="center" cellpadding="5" bgcolor="#699fcb">
      <tr>
        <td width="31%" align="right" valign="bottom"><label>Salutation</label></td>
        <td width="69%" valign="bottom"><select name="salutation_addperson" size="1" tabindex="1" >
          <option> </option>
          <option value="Dr">Dr</option>
          <option value="Miss">Miss</option>
          <option value="Mr">Mr</option>
          <option value="Mrs">Mrs</option>
          <option value="Ms">Ms</option>
        </select></td>
      </tr>
      <tr>
        <td align="right"><label>Firstname</label></td>
        <td><input name="firstname_addperson" type="text" class="fields" id="firstname_addperson" tabindex="2" /></td>
      </tr>
      <tr>
        <td align="right"><label>Surname</label></td>
        <td><input class="fields" type="text" name="surname_addperson" id="surname_addperson" tabindex="3" /></td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td><input type="button" name="Button" onclick = "removed()" id="button" value="cancel" /></td>
      </tr>
    </table>
    
    
    
    </div>
    
    
    <script type = "text/javascript">
    function add_person(){
    
    document.getElementById("surname_addperson").value="  ";
    }
    
    function removed(){
    
    document.getElementById("surname_addperson").value="";
    document.getElementById("firstname_addperson").value="";
    document.getElementById("salutation_addperson").value="";
    }
    </script>
             
             </td>
            </tr>
          </table>
          
          
        <div id="formcenter">
            <h2 class="blue">Terms and Conditions</h2>
          <div id="TandC">
            <p>DATA PROTECTION 1998</p>
          
            <p> Terms and conditions here
              </p>
                     
          </div>
    
         
            <label>
              <input type="checkbox" name="read" id="read" />
              I have read and agree to the terms and conditions</label>
          
          <input name="eventname" type="hidden" id="eventname" value="Online Marketing Success for Business" /> 
       
    
         <input name="submit" type="submit" class="buttonSubmit" onclick="YY_checkform('myform','read','#q','1','Please read the terms and conditions before continuing','events[0]','#q','2','Please select a Venue','events[1]','#q','2','','events[2]','#q','2','','events[3]','#q','2','','events[4]','#q','2','','events[5]','#q','2','','company_name','#q','0','Please Enter your Company Name','firstname','#q','0','Please Enter your Firstname','surname','#q','0','Please Enter your Surname','business','#q','0','Please Enter the Nature of your Business','email','#S','2','Please Enter your Email Address','address1','#q','0','Please Enter your Address','phone','#q','0','Please Enter your Phone','Town','#q','0','Please Enter your Town','Postcode','#q','0','Please Enter your Postcode','salutation','#q','1','Please select your Title');return document.MM_returnValue" value="Submit" /><input name="processing" type="text" disabled="disabled" id="processing" size="40" readonly="true" /> 
      </div>
    </form>
    here is the asp file

    Code:
    <%
    
    salutation = request("salutation")
    firstname = request("firstname")
    surname = request("surname")
    email = request("email")
    phone = request("phone")
    gender = request("gender")
    ethnicity = request("ethnicity")
    company_name = request("company_name")
    business = request("business")
    business_start_date = request("business_start_date")
    address1 = request("address1")
    address2 = request("Address2")
    address3 = request("address3")
    town = request("Town")
    postcode = request("postcode")
    signup = request("signup")
    
    <!--#INCLUDE VIRTUAL="connection.asp"-->
    
    SQLTemp = "INSERT INTO newsletter (salutation, firstname, surname, email, phone, gender, ethnicity, company_name, business, business_start_date, address1, address2, address3, town, postcode, signup) values ('" & salutation & "', '" & firstname & "','" & surname & "','" & email & "','" & phone & "','" & gender & "','" & ethnicity & "','" & company_name & "','" & business & "','" & business_start_date & "','" & address1 & "','" & address2 & "','" & address3 & "','" & town & "','" & postcode & "','" & signup & "')"
    conn.execute(SQLTemp)
    
    conn.Close
    Set conn = Nothing
    
    Set Mail = Server.CreateObject("SMTPsvg.Mailer")
    Mail.FromName   = Request.QueryString("name")
    Mail.FromAddress= Request.QueryString("email")
    Mail.RemoteHost = "mrelay.perfora.net" 
    
    Mail.AddRecipient "Design", "confirmation@design.co.uk"
    Mail.AddRecipient "Design", "info@design.co.uk"
    
    Mail.Subject    = "Event booked - " & Request.QueryString("events")
    Mail.BodyText   = BodyText & Request.QueryString("salutation") & " " & Request.QueryString("firstname") & " " & Request.QueryString("surname") & " " & "has booked a place on the following event " 
    Mail.BodyText   = " "
    Mail.BodyText   = BodyText & Request.QueryString("salutation_addperson") & " " & Request.QueryString("firstname_addperson") & " " & Request.QueryString("surname_addperson") & " " & "is also attending " 
    Mail.BodyText   = " "
    
    Mail.BodyText   = "Event Name:  " & Request.QueryString("eventname")
    Mail.BodyText   = " "
    Mail.BodyText   = "Event Date and Venue:  " & Request.QueryString("events")
    Mail.BodyText   = " "
    Mail.BodyText   = "Attendee details:"
    Mail.BodyText   = " "
    Mail.BodyText   = "Company name:  " & Request.QueryString("company_name")
    Mail.BodyText   = " "
    Mail.BodyText   = "Nature of business:  " & Request.QueryString("business")
    Mail.BodyText   = " "
    Mail.BodyText   = "Address1:   " & Request.QueryString("address1")
    Mail.BodyText   = "Address2:  " & Request.QueryString("address2")
    Mail.BodyText   = "Address3:   " & Request.QueryString("Address3")
    Mail.BodyText   = "Town:   " & Request.QueryString("Town")
    Mail.BodyText   = "Postcode:  " & Request.QueryString("Postcode")
    Mail.BodyText   = " "
    Mail.BodyText   = "Email address:  " & Request.QueryString("email")
    Mail.BodyText   = " "
    Mail.BodyText   = "Telephone number:   " & Request.QueryString("phone")
    Mail.BodyText   = " "
    Mail.BodyText   = "Business start date:  " & Request.QueryString("business_start_date")
    Mail.BodyText   = " "
    Mail.BodyText   = "Gender:  " & Request.QueryString("gender")
    Mail.BodyText   = "Ethnicity:  " & Request.QueryString("ethnicity")
    
    
    if Mail.SendMail then
     Response.Redirect("successful.html")
    else
     Response.Write "Mail send failure. Error was " & Mail.Response
    end if 
    Set Mail = Nothing
    %>

  7. #7
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your code looks fine.

    You'll need to wait until there is more information to work with.

  8. #8
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there haven't been any complaints about the error now so I'm hoping that its no longer a problem!

    Only thing I want to get to the bottom of is the duplicate entries...
    Not sure what information I can wait for to solve that problem.

    May be it'll be worth checking to see if the person has booked a place already - if they have then a message will appear saying they have already booked a place?

  9. #9
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The people having problems will have made some form of typo, or have details that your code cannot handle. E.g. they might have a name that includes an apostrophe, like O'Hara. As you are not validating the use input then your code is wide open to abuse - both your database AND you emailer!
    Ian Anderson
    www.siteguru.co.uk

  10. #10
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply - yup thats exactly what it was. The was an apostrophe in my code... the form is working now.

    any ideas about the random duplicate entries?


Bookmarks

Posting Permissions

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