|
nettop -> Submit Data to Database and Send Email Confirmation (4/29/2008 0:02:41)
|
I've seen the various posts for how to do this, but I am unable to get this default.asp page to work to submit 1 field of data to the database AND send a confirmation email. Here's the appropriate HTML: <%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear
strErrorUrl = ""
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear
Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"
Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"
fp_conn.Open Application("email_newsletter_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"
fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"
fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(1)
Dim arFormDBFields0(1)
Dim arFormValues0(1)
arFormFields0(0) = "Email_newsletter"
arFormDBFields0(0) = "Email_newsletter"
arFormValues0(0) = Request("Email_newsletter")
FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0
If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"), "Browser_type"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"), "Remote_computer_name"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "User_name"
End If
fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"
fp_rs.Close
fp_conn.Close
Set oMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
iConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
iConf.Fields.Update
Set oMail.Configuration = iConf
oMail.To = "info@foothillbiz4sale.com"
oMail.From = "webmaster@foothillbiz4sale.com"
oMail.Subject = "Subject - NEW Newsletter Request, Page 1 completed"
oMail.TextBody = "Hey Michele: Someone has signed up to receive your newsletter from the homepage... Tim"
oMail.Send
Set iConf = Nothing
Set Flds = Nothing
Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "email_newsletter.asp"
End If
End If
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
%>
<html>
............................
<form method="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"-->
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table14">
<tr>
<td>
<p align="justify">Receive the most comprehensive information about Businesses for Sale in the Grass Valley and Auburn Areas.<br>
<font color="#F4F2EB">
<span style="font-size: 4pt">
adfasdfdf</span></font></td>
</tr>
<tr>
<td>
<p align="center">
<input type="text" name="Email_newsletter" size="30" value="ENTER EMAIL ADDRESS">
<input type="submit" value="Submit" name="B3"><input type="reset" value="Reset" name="B4">
</td>
</tr>
<tr>
<td height="6"></td>
</tr>
<tr>
<td>Our team of
specialists track local businesses for
sale, sale statistics and provide
valuable articles, unavailable anywhere
else. We publish this information in our
Quarterly Newsletter. If you want to
keep ahead of market conditions, know
what is going on with businesses in the
area and receive informative articles
about business valuation and business
selling, subscribe to our newsletter -
it's free.</td>
</tr>
</table>
<input type="hidden" name="VTI-GROUP" value="0">
</form>
|
|
|
|