Firstly my submit form goes directly to the thank_u.htm page when someone clicks on the link to go to my submit form.
Secondly if I take the response.redirect line out of my code, I get an empty email when someone opens the page and then the second one when the person clicks on the submit button. (The second email works fine.)
I think the answer for 1 should solve 2 as well.
Here is my code.
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>Submit Query</title>
- <link rel="stylesheet" type="text/css" href="../css/submit.css">
- </head>
- <h1>QUOTE FORM</h1>
- <body>
- <form name="feedback" method="post" action="submit.asp">
- <label for="user">Your Name:</label>
- <input type="text" name="txtName" ><br>
- <label for="user">The Name of your Business:</label>
- <textarea name="txtBusiness" id="newsize" ></textarea><br>
- <label for="user">Your Email Address:</label>
- <input type="text" name="txtEmail" class="text"><br>
- <label for="user">Your Cellphone number:</label>
- <input type="text" name="txtCell" ><br>
- <label for="user">Registered with us: [y/n]</label>
- <input type="text" name="txtRegistered" ><br>
- <label for="user">Your Quote:</label>
- <textarea name="txtQuote" class="input"></textarea><br>
- <a href="#"><input type="submit" class="submit" value="Submit"></a>
- </form>
- </body>
- </html>
- <%
- Dim HTMLBody
- HTMLBody = HTMLBody & Replace(Request.Form("Contact_"), vbCrLf, "<br />") & "<br>" & "<br>"
- HTMLBody = HTMLBody & "<strong>" & "Your Name : " & "</strong>" & Request.Form("txtName") & "<br>"
- HTMLBody = HTMLBody & "<strong>" & " The Name of your Business : " & "</strong>" & Request.Form("txtBusiness") & "<br>"
- HTMLBody = HTMLBody & "<strong>" & "Your Email address : " & "</strong>" & Request.Form("txtEmail") & "<br>"
- HTMLBody = HTMLBody & "<strong>" & "Your Cellphone Number : " & "</strong>" & Request.Form("txtCell") & "<br>"
- HTMLBody = HTMLBody & "<strong>" & "Registered with us [y/n] : " & "</strong>" & Request.Form("txtRegistered") & "<br>"
- HTMLBody = HTMLBody & "<strong>" & "Your Quote : " & "</strong>" & Request.Form("txtQuote") & "<br>"
- 'Create the e-mail server object
- Set objCDOSYSMail = Server.CreateObject("CDO.Message")
- Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
- 'Outgoing SMTP server
- objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
- objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
- objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
- objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
- objCDOSYSCon.Fields.Update 'Update the CDOSYS Configuration
- Set objCDOSYSMail.Configuration = objCDOSYSCon
- objCDOSYSMail.From = "**.*****.co.za "
- objCDOSYSMail.To = "**@*****.co.za"
- objCDOSYSMail.Subject = "Test"
- objCDOSYSMail.HTMLBody = htmlBody
- objCDOSYSMail.Send
- 'Close the server mail object
- Set objCDOSYSMail = Nothing
- Set objCDOSYSCon = Nothing
- %>