B
Bob Leffew
I am new at using VB Script in an ASP page using Dreamweaver MX
I had tried to build a Login page that verified that the users email address
was not in a database, then insert the data from the form into a databas
plus email the results back to me.
Everything worked fine execpt for the emailing part.
So I take the email out of the registration page, set a session variable to
the email address, and redirect to a page called LSIEmailForm.
In this page I set up a form with Hidden fields thats poplulates each field
from reading the database from the session variable which I set in the
previous page with the email address.
What I need to do is 1) Read the database 2)email the results to myself 3)
then redirect automatically to a Registration Successfull page. (This needs
to be a pass thru page from Registration to Registration successfull)
I have the code below but I cant get it to work.
Any suggestions?
<%@LANGUAGE="VBSCRIPT"%>
'*************
'Read Database from Session Variable set from previous page
'*************
<!--#include file="../Connections/cnLSI.asp" -->
<%
Dim rsLSI__MMColParam
rsLSI__MMColParam = "1"
If (Session("svEmailAddress") <> "") Then
rsLSI__MMColParam = Session("svEmailAddress")
End If
%>
<%
Dim rsLSI
Dim rsLSI_numRows
Set rsLSI = Server.CreateObject("ADODB.Recordset")
rsLSI.ActiveConnection = MM_cnLSI_STRING
rsLSI.Source = "SELECT * FROM UserLog WHERE EmailAddress = '" +
Replace(rsLSI__MMColParam, "'", "''") + "'"
rsLSI.CursorType = 0
rsLSI.CursorLocation = 2
rsLSI.LockType = 1
rsLSI.Open()
rsLSI_numRows = 0
%>
<%
'**********
' *** Send Form Values From Same Page to Webmaster - ASPMail_111
'**********
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
' Specify a valid sender's address
Mailer.FromAddress= "(e-mail address removed)"
' Specify a valid SMTP server
Mailer.RemoteHost = "mail-fwd.bellsouth-hosting.net"
Mailer.AddRecipient "", "(e-mail address removed)"
Mailer.Subject = "LSI Registration"
Mailer.BodyText = Chr(13) & Chr(10) &_
"EmailAddress" & ": " & cStr(Request("EmailAddress")) & Chr(13) & Chr(10) &_
"Password" & ": " & cStr(Request("Password")) & Chr(13) & Chr(10) &_
"RegistrationDate" & ": " & cStr(Request("RegistrationDate")) & Chr(13) &
Chr(10) &_
"FirstName" & ": " & cStr(Request("FirstName")) & Chr(13) & Chr(10) &_
"LastName" & ": " & cStr(Request("LastName")) & Chr(13) & Chr(10) &_
"Title" & ": " & cStr(Request("Title")) & Chr(13) & Chr(10) &_
"Company" & ": " & cStr(Request("Company")) & Chr(13) & Chr(10) &_
"Address" & ": " & cStr(Request("Address")) & Chr(13) & Chr(10) &_
"Address2" & ": " & cStr(Request("Address2")) & Chr(13) & Chr(10) &_
"City" & ": " & cStr(Request("City")) & Chr(13) & Chr(10) &_
"State" & ": " & cStr(Request("State")) & Chr(13) & Chr(10) &_
"ZipCode" & ": " & cStr(Request("ZipCode")) & Chr(13) & Chr(10) &_
"Country" & ": " & cStr(Request("Country")) & Chr(13) & Chr(10) &_
"WorkPhone" & ": " & cStr(Request("WorkPhone")) & Chr(13) & Chr(10) &_
"WorkFax" & ": " & cStr(Request("WorkFax")) & Chr(13) & Chr(10) &_
"MobilePhone" & ": " & cStr(Request("MobilePhone"))
Mailer.SendMail
Response.Redirect "LSIRegistrationSuccessful.asp"
End If
%>
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0">
<div align="left">
<form ACTION="" METHOD="" name="form1" target="_blank" onSubmit="">
<div align="left">
<p> </p>
<table width="100%" border="0" align="left" cellpadding="4"
cellspacing="5">
<tr align="left" valign="middle">
<td width="18%"><div align="right"><strong></strong></div></td>
<td width="82%" colspan="2"><div align="left"><strong><font
color="#000099" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="EmailAddress" type="hidden" id="EmailAddress"
value="<%=(rsLSI.Fields.Item("EmailAddress").Value)%>">
<input name="Password" type="hidden" id="Password"
value="<%=(rsLSI.Fields.Item("Password").Value)%>">
<input name="RegistrationDate" type="hidden"
id="RegistrationDate"
value="<%=(rsLSI.Fields.Item("RegistrationDate").Value)%>">
<input name="FirstName" type="hidden" id="FirstName"
value="<%=(rsLSI.Fields.Item("FirstName").Value)%>">
<input name="LastName" type="hidden" id="LastName"
value="<%=(rsLSI.Fields.Item("LastName").Value)%>">
<input name="Title" type="hidden" id="Title2"
value="<%=(rsLSI.Fields.Item("Title").Value)%>">
<input name="Company" type="hidden" id="Company"
value="<%=(rsLSI.Fields.Item("Company").Value)%>">
<input name="Address" type="hidden" id="Address"
value="<%=(rsLSI.Fields.Item("Address").Value)%>">
<input name="Address2" type="hidden" id="Address2"
value="<%=(rsLSI.Fields.Item("Address2").Value)%>">
<input name="City" type="hidden" id="City"
value="<%=(rsLSI.Fields.Item("City").Value)%>">
<input
name=State type=hidden
value="<%=(rsLSI.Fields.Item("State").Value)%>">
<input name="ZipCode" type="hidden" id="ZipCode"
value="<%=(rsLSI.Fields.Item("ZipCode").Value)%>">
<input name="Country" type="hidden" id="Country"
value="<%=(rsLSI.Fields.Item("Country").Value)%>">
<input name="WorkPhone" type="hidden" id="WorkPhone"
value="<%=(rsLSI.Fields.Item("WorkPhone").Value)%>">
<input name="WorkFax" type="hidden" id="WorkFax"
value="<%=(rsLSI.Fields.Item("WorkFax").Value)%>">
<input
name=MobilePhone type=hidden id="MobilePhone"
value="<%=(rsLSI.Fields.Item("MobilePhone").Value)%>">
</font></strong></div></td>
</tr>
</table>
<p> </p>
</div>
</form>
</div>
</body>
</html>
<%
rsLSI.Close()
Set rsLSI = Nothing
%>
I had tried to build a Login page that verified that the users email address
was not in a database, then insert the data from the form into a databas
plus email the results back to me.
Everything worked fine execpt for the emailing part.
So I take the email out of the registration page, set a session variable to
the email address, and redirect to a page called LSIEmailForm.
In this page I set up a form with Hidden fields thats poplulates each field
from reading the database from the session variable which I set in the
previous page with the email address.
What I need to do is 1) Read the database 2)email the results to myself 3)
then redirect automatically to a Registration Successfull page. (This needs
to be a pass thru page from Registration to Registration successfull)
I have the code below but I cant get it to work.
Any suggestions?
<%@LANGUAGE="VBSCRIPT"%>
'*************
'Read Database from Session Variable set from previous page
'*************
<!--#include file="../Connections/cnLSI.asp" -->
<%
Dim rsLSI__MMColParam
rsLSI__MMColParam = "1"
If (Session("svEmailAddress") <> "") Then
rsLSI__MMColParam = Session("svEmailAddress")
End If
%>
<%
Dim rsLSI
Dim rsLSI_numRows
Set rsLSI = Server.CreateObject("ADODB.Recordset")
rsLSI.ActiveConnection = MM_cnLSI_STRING
rsLSI.Source = "SELECT * FROM UserLog WHERE EmailAddress = '" +
Replace(rsLSI__MMColParam, "'", "''") + "'"
rsLSI.CursorType = 0
rsLSI.CursorLocation = 2
rsLSI.LockType = 1
rsLSI.Open()
rsLSI_numRows = 0
%>
<%
'**********
' *** Send Form Values From Same Page to Webmaster - ASPMail_111
'**********
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
' Specify a valid sender's address
Mailer.FromAddress= "(e-mail address removed)"
' Specify a valid SMTP server
Mailer.RemoteHost = "mail-fwd.bellsouth-hosting.net"
Mailer.AddRecipient "", "(e-mail address removed)"
Mailer.Subject = "LSI Registration"
Mailer.BodyText = Chr(13) & Chr(10) &_
"EmailAddress" & ": " & cStr(Request("EmailAddress")) & Chr(13) & Chr(10) &_
"Password" & ": " & cStr(Request("Password")) & Chr(13) & Chr(10) &_
"RegistrationDate" & ": " & cStr(Request("RegistrationDate")) & Chr(13) &
Chr(10) &_
"FirstName" & ": " & cStr(Request("FirstName")) & Chr(13) & Chr(10) &_
"LastName" & ": " & cStr(Request("LastName")) & Chr(13) & Chr(10) &_
"Title" & ": " & cStr(Request("Title")) & Chr(13) & Chr(10) &_
"Company" & ": " & cStr(Request("Company")) & Chr(13) & Chr(10) &_
"Address" & ": " & cStr(Request("Address")) & Chr(13) & Chr(10) &_
"Address2" & ": " & cStr(Request("Address2")) & Chr(13) & Chr(10) &_
"City" & ": " & cStr(Request("City")) & Chr(13) & Chr(10) &_
"State" & ": " & cStr(Request("State")) & Chr(13) & Chr(10) &_
"ZipCode" & ": " & cStr(Request("ZipCode")) & Chr(13) & Chr(10) &_
"Country" & ": " & cStr(Request("Country")) & Chr(13) & Chr(10) &_
"WorkPhone" & ": " & cStr(Request("WorkPhone")) & Chr(13) & Chr(10) &_
"WorkFax" & ": " & cStr(Request("WorkFax")) & Chr(13) & Chr(10) &_
"MobilePhone" & ": " & cStr(Request("MobilePhone"))
Mailer.SendMail
Response.Redirect "LSIRegistrationSuccessful.asp"
End If
%>
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0">
<div align="left">
<form ACTION="" METHOD="" name="form1" target="_blank" onSubmit="">
<div align="left">
<p> </p>
<table width="100%" border="0" align="left" cellpadding="4"
cellspacing="5">
<tr align="left" valign="middle">
<td width="18%"><div align="right"><strong></strong></div></td>
<td width="82%" colspan="2"><div align="left"><strong><font
color="#000099" size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name="EmailAddress" type="hidden" id="EmailAddress"
value="<%=(rsLSI.Fields.Item("EmailAddress").Value)%>">
<input name="Password" type="hidden" id="Password"
value="<%=(rsLSI.Fields.Item("Password").Value)%>">
<input name="RegistrationDate" type="hidden"
id="RegistrationDate"
value="<%=(rsLSI.Fields.Item("RegistrationDate").Value)%>">
<input name="FirstName" type="hidden" id="FirstName"
value="<%=(rsLSI.Fields.Item("FirstName").Value)%>">
<input name="LastName" type="hidden" id="LastName"
value="<%=(rsLSI.Fields.Item("LastName").Value)%>">
<input name="Title" type="hidden" id="Title2"
value="<%=(rsLSI.Fields.Item("Title").Value)%>">
<input name="Company" type="hidden" id="Company"
value="<%=(rsLSI.Fields.Item("Company").Value)%>">
<input name="Address" type="hidden" id="Address"
value="<%=(rsLSI.Fields.Item("Address").Value)%>">
<input name="Address2" type="hidden" id="Address2"
value="<%=(rsLSI.Fields.Item("Address2").Value)%>">
<input name="City" type="hidden" id="City"
value="<%=(rsLSI.Fields.Item("City").Value)%>">
<input
name=State type=hidden
value="<%=(rsLSI.Fields.Item("State").Value)%>">
<input name="ZipCode" type="hidden" id="ZipCode"
value="<%=(rsLSI.Fields.Item("ZipCode").Value)%>">
<input name="Country" type="hidden" id="Country"
value="<%=(rsLSI.Fields.Item("Country").Value)%>">
<input name="WorkPhone" type="hidden" id="WorkPhone"
value="<%=(rsLSI.Fields.Item("WorkPhone").Value)%>">
<input name="WorkFax" type="hidden" id="WorkFax"
value="<%=(rsLSI.Fields.Item("WorkFax").Value)%>">
<input
name=MobilePhone type=hidden id="MobilePhone"
value="<%=(rsLSI.Fields.Item("MobilePhone").Value)%>">
</font></strong></div></td>
</tr>
</table>
<p> </p>
</div>
</form>
</div>
</body>
</html>
<%
rsLSI.Close()
Set rsLSI = Nothing
%>