sniperman
12-15-2010, 06:35 AM
Hi, having some problems trying to get this code to send an email after it has updated a MS Access database.
The query to MS Access works fine. Being able to use those same variables requested from a HTML form however does not work.
<%
action=trim(request("action"))
if action="add" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from Payment"
rs.open sql,conn,1,3
rs.addnew
rs("Model")=trim(Request("Model"))
rs("Description")=trim(Request("Description"))
rs("Quantity")=trim(Request("Quantity"))
rs("Price")=trim(Request("Price"))
rs("Postage")=trim(Request("Postage"))
rs("Total")=trim(Request("Total"))
rs("CustomerName")=trim(Request("CustomerName"))
rs("Address")=trim(Request("Address"))
rs("Email")=trim(Request("Email"))
rs("OrderDate")=trim(Request("OrderDate"))
rs("Message")=trim(Request("Message"))
rs("adddate")=now()
rs.update
rs.close
set rs=nothing
sFrom = Request.Form("name") & "<" & Request.Form("email") & ">"
sTo = "mail@mail.com"
sSubject = "SUBJECT LINE HERE"
sMessage = "Name : " & Request.Form("name") & vbcrlf & vbcrlf _
& "e-mail : " & Request.Form("email") & vbcrlf & vbcrlf _
& "Their Message:" & Request.Form("Message")
Set objNewMail = CreateObject("CDONTS.NewMail")
objNewMail.Send sFrom, sTo, sSubject, sMessage
Set objNewMail = Nothing
response.Write "<script language=javascript>alert('Your submission was successful!');window.location.href='Payment.html';</script>"
end if
%>
The query to MS Access works fine. Being able to use those same variables requested from a HTML form however does not work.
<%
action=trim(request("action"))
if action="add" then
set rs=server.CreateObject("adodb.recordset")
sql="select * from Payment"
rs.open sql,conn,1,3
rs.addnew
rs("Model")=trim(Request("Model"))
rs("Description")=trim(Request("Description"))
rs("Quantity")=trim(Request("Quantity"))
rs("Price")=trim(Request("Price"))
rs("Postage")=trim(Request("Postage"))
rs("Total")=trim(Request("Total"))
rs("CustomerName")=trim(Request("CustomerName"))
rs("Address")=trim(Request("Address"))
rs("Email")=trim(Request("Email"))
rs("OrderDate")=trim(Request("OrderDate"))
rs("Message")=trim(Request("Message"))
rs("adddate")=now()
rs.update
rs.close
set rs=nothing
sFrom = Request.Form("name") & "<" & Request.Form("email") & ">"
sTo = "mail@mail.com"
sSubject = "SUBJECT LINE HERE"
sMessage = "Name : " & Request.Form("name") & vbcrlf & vbcrlf _
& "e-mail : " & Request.Form("email") & vbcrlf & vbcrlf _
& "Their Message:" & Request.Form("Message")
Set objNewMail = CreateObject("CDONTS.NewMail")
objNewMail.Send sFrom, sTo, sSubject, sMessage
Set objNewMail = Nothing
response.Write "<script language=javascript>alert('Your submission was successful!');window.location.href='Payment.html';</script>"
end if
%>