Hey,
I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen:
1. The form uploads to a database (the following code does this)
2. An e-mail is sent to my sales team as well as the customer, which contains the form values .
3. I want the user to then be directed automatically to another webpage, after they hit the submit button. (This page will read something like "Thank you for submitting your application).
I am able to do this on 2 seperate asp pages but when i try to do this on one asp page,its not working.
Please help me to solve this.
is it possible that once user hits submit button values of the form goes to insertintodatab ase.asp and then somehow these values can move to sendemail.asp.p lease help me.
I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen:
1. The form uploads to a database (the following code does this)
2. An e-mail is sent to my sales team as well as the customer, which contains the form values .
3. I want the user to then be directed automatically to another webpage, after they hit the submit button. (This page will read something like "Thank you for submitting your application).
I am able to do this on 2 seperate asp pages but when i try to do this on one asp page,its not working.
Please help me to solve this.
is it possible that once user hits submit button values of the form goes to insertintodatab ase.asp and then somehow these values can move to sendemail.asp.p lease help me.
Code:
<%> <% Dim thedate,Email,Customer,Contact,Phone,Fax,Address,City,State,Zip,part1,qty1,invoice1,po1,date1,serial1,problem1,part2,qty2,invoice2,po2,date2,serial2,problem2 Dim part3,qty3,invoice3,po3,date3,serial3,problem3,part4,qty4,invoice4,po4,date4,serial4,problem4,terms,delivery,comments Dim sConnString, conn, sSQL, stSQL Dim MyNewRandomNum Randomize MyNewRandomNum = Int(Rnd * 10000000)+1 thedate=Request.form("thedate") Email=Request.form("Email") Customer=Request.form("Customer") Contact=Request.form("Contact") Phone=Request.form("Phone") Fax=Request.form("Fax") Address=Request.form("Address") City=Request.form("City") State=Request.form("State") Zip=Request.form("Zip") part1=Request.form("part1") qty1=Request.form("qty1") invoice1=Request.form("invoice1") po1=Request.form("po1") date1=Request.form("date1") serial1=Request.form("serial1") problem1=Request.form("problem1") part2=Request.form("part2") qty2=Request.form("qty2") invoice2=Request.form("invoice2") po2=Request.form("po2") date2=Request.form("date2") serial2=Request.form("serial2") problem2=Request.form("problem2") part3=Request.form("part3") qty3=Request.form("qty3") invoice3=Request.form("invoice3") po3=Request.form("po3") date3=Request.form("date3") serial3=Request.form("serial3") problem3=Request.form("problem3") part4=Request.form("part4") qty4=Request.form("qty4") invoice4=Request.form("invoice4") po4=Request.form("po4") date4=Request.form("date4") serial4=Request.form("serial4") problem4=Request.form("problem4") terms=Request.form("terms") delivery=Request.form("delivery") comments=Request.form("comments") sSQL = "INSERT into rmarequest (req_no, date, email, company, contact, phone, fax, address, city, state, zip, part1, qty1, inv1, po1, inv_date1, serial1, problem1, part2, qty2, inv2, po2, inv_date2, serial2, problem2, part3, qty3, inv3, po3, inv_date3, serial3, problem3, part4, qty4, inv4, po4, inv_date4) values('" & MyNewRandomNum & "', '" & thedate & "','" & Email & "','" & Customer & "','" & Contact & "','" & Phone & "', '" & Fax & "', '" & Address & "', '" & City & "', '" & State & "','" & Zip & "', '" & part1 & "', '" & qty1 & "', '" & invoice1 & "', '" & po1 & "', '" & date1 & "', '" & serial1 & "', '" & problem1 & "', '" & part2 & "', '" & qty2 & "', '" & invoice2 & "', '" & po2 & "', '" & date2 & "', '" & serial2 & "', '" & problem2 & "', '" & part3 & "', '" & qty3 & "', '" & invoice3 & "', '" & po3 & "', '" & date3 & "', '" & serial3 & "', '" & problem3 & "', '" & part4 & "', '" & qty4 & "', '" & invoice4 & "', '" & po4 & "', '" & date4 & "')" stSQL= "INSERT into rmarequest (serial4, problem4, terms, delivery, comments)values( '" & serial4 & "', '" & problem4 & "', '" & terms & "', '" & delivery & "', '" & Comments & "')" Set conn = server.CreateObject("ADODB.connection") sConnString = "DRIVER=SQL Server;SERVER={};UID={}; PWD={};APP=;DATABASE={}" conn.Open sConnString conn.execute(sSQL) conn.execute(stSQL) connection.Close Set conn = Nothing %><% bodytext = "" bodytext = bodytext& "<HTML><HEAD><title>RMA Request Recieved@A3Net</title>" bodytext = bodytext&"<meta http-equiv=Content-Type content=text/css; charset=UTF-8>" bodytext = bodytext&"<style fprolloverstyle>" bodytext = bodytext&"A:hover {color: #F6D271; font-weight: bold}.style6 {font-size: 10pt;font-weight: bold;}" bodytext = bodytext&".style7 {font-family: MS Sans Serif}.style8 {font-size: 10pt; font-weight: bold; font-family: MS Sans Serif; }" bodytext = bodytext&".style10 {font-family: MS Sans Serif;font-size: 1pt;color: #000066;font-weight: bold;}" bodytext = bodytext&".style13 {font-size: 10pt}.style14 {font-size: 1pt; color: #000066; font-family: MS Sans Serif;}" bodytext = bodytext&".style16 {font-family: MS Sans Serif;color: #003333;font-weight: bold;font-size: medium;}" bodytext = bodytext&".style17 {color: #336699}.style20 {font-family: Webdings; color: #DFAE0E;}" bodytext = bodytext&".style21 {font-size: 1pt}.style22 {font-size: 1pt; font-family: MS Sans Serif; }" bodytext = bodytext&".style24 { font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;font-size: 9pt;}" bodytext = bodytext&".style25 { color: #000000; font-size: 9px;}" bodytext = bodytext&"</style>" bodytext = bodytext&"</HEAD>" bodytext = bodytext&"<BODY BGCOLOR=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 link=#FFFFFF vlink=#FFFFFF alink=#FFFFFF>" bodytext = bodytext&"<span class=bodyplaingrey></span> <span class=bodyplainred></span> <span class=credit></span> " bodytext = bodytext&"<span class=boldwhiteCopy></span> <span class=boldwhite></span> <span class=bodyplain></span> " bodytext = bodytext&"<center>" bodytext = bodytext&"<table border=1 cellpadding=0 cellspacing=0>" bodytext = bodytext&"<tr BGCOLOR=#cccccc><td align=center valign=middle><span class=style16>RMA Request Recieved@A3net</span></td>" bodytext = bodytext&"</tr><tr BGCOLOR=#e4e4e4><td align=center valign=middle><span class=style7>RMA Request Number:</span><span class=style24 style7 style13> " bodytext = bodytext&MyNewRandomNum bodytext = bodytext&"</span></td></tr><tr><td align=left valign=middle>" bodytext = bodytext&"<table width=574 border=0 align=left cellpadding=0 cellspacing=0 bordercolor=#e2e2e2><tr>" bodytext = bodytext&"<td align=left valign=top class=style7> </td>" bodytext = bodytext&"<td align=left valign=top class=style6> </td></tr>" bodytext = bodytext&"<tr><td align=left valign=top class=style7> </td>" bodytext = bodytext&"<td align=left valign=top class=style6> </td></tr>" bodytext = bodytext&"<tr bgcolor=#E4E4E4 height=30><td width=279 align=left valign=top class=style7><span class=style13><span class=style10> Request Date :</span></span><br><span class=style13> " bodytext = bodytext&thedate bodytext = bodytext&"<br></span></td>" bodytext = bodytext&"<td width=288 align=left valign=top><span class=style10> Email:</span><br><span class=style24 style7 style13> " bodytext = bodytext&"</table>" bodytext = bodytext&"</td></tr><tr align=left valign=top><td colspan=2 class=style8> </td>" bodytext = bodytext&"</tr><tr align=left valign=middle bgcolor=#E4E4E4><td height=30 colspan=2><span class=style10> Term of Exchange:</span><br><span class=style24 style7 style13> " bodytext = bodytext&terms bodytext = bodytext&"</span></td></tr>" bodytext = bodytext&"<tr align=left valign=top><td colspan=2 class=style8> </td></tr>" bodytext = bodytext&"<tr align=left valign=top bgcolor=#E4E4E4 height=30><td colspan=2><span class=style10> Delivery Method:</span> <br><span class=style24 style7 style13>" bodytext = bodytext&" " bodytext = bodytext&delivery bodytext = bodytext&"</span></td></tr><tr align=left valign=top><td colspan=2 class=style8> </td>" bodytext = bodytext&"</tr><tr align=left valign=top bgcolor=#E4E4E4 height=20>" bodytext = bodytext&"<td colspan=2><span class=style10> Explain Problem:</span><br>" bodytext = bodytext&" <span class=style24 style7 style13>" bodytext = bodytext&comments bodytext = bodytext&"</span></td></tr><tr align=left valign=top><td colspan=2 class=style8> </td>" bodytext = bodytext&"</tr><tr align=left valign=top><td colspan=2 class=style8> </td></tr></table>" bodytext = bodytext&"</td></tr></table>" bodytext = bodytext&"</center>" bodytext = bodytext&"</BODY>" bodytext = bodytext&"</HTML>" Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.FromAddress = "sales@a3net.com" Mailer.Cc = Email Mailer.RemoteHost = "scriptmail.intermedia.net" Mailer.AddRecipient "A3Net Servers Inc","rma@a3net.com" Mailer.Subject = "A3net RMA Request("&MyNewRandomNum&")" Mailer.ContentType = "text/html" Mailer.BodyText = bodytext if Mailer.SendMail then 'Message sent sucessfully Response.Redirect "rmarequestsuccess.asp" else Response.Redirect "rmarequestfailure.asp" end if %> <%>
Comment