Hello Everyone I am new to this site and I hope that I can find help.
I am using the Active Server Pages 3.0 book and I have to modify my registrationconfirm.asp page to store the registration information int eh database. The problem is the book doesn't give good examples and the download code is a little confusing. Here is my registrationconfirm.asp page:
<%@ Language=VBScript %>
<%
Option Explicit
Dim strFIRST, strLAST, strADDR1, strCITY, strSTATE, strZIP, strEMAIL, strPASSWORD
strFIRST = Request("FIRST_NM")
strLAST = Request.Form("LAST_NM")
strADDR1 = Request.Form("ADDR1")
strCITY = Request.Form("CITY_NM")
strSTATE = Request.Form("STATE_CD")
strZIP = Request.Form("ZIP_CD")
strEMAIL = Request.Form("EMAIL_ADDR")
strPASSWORD = Request.Form("PASSWORD")
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<title>Here is your e-mail confirmation</title><head>
<body>
<H3>Registration Complete</H3>
<%
rem ------------------------------------
rem - Instantiate the SMTP mailer object
rem ------------------------------------
dim Mailer
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
rem ------------------------------------
rem - Set the FromName and FromAddress
rem - WARNING: These are REQUIRED FIELDS
rem ------------------------------------
Mailer.FromName = "JavaScripts R Us"
Mailer.FromAddress = "
[email protected]"
rem ------------------------------------
rem - Set the Remote Host (SMTP) Host
rem - that we'll send this mail thru
rem ------------------------------------
Mailer.RemoteHost = "mail.davenport.edu"
rem ------------------------------------
rem - Set the recipient's address
rem - that this message will go to
rem - < To Name, email address
rem ------------------------------------
Mailer.AddRecipient "Donna A","
[email protected]"
rem ------------------------------------
rem - Set the subject line
rem ------------------------------------
Mailer.Subject = "JavaScripts R Us Registration!"
rem ------------------------------------
rem - Set the message body text
rem -
rem - To optionally clear the text once
rem - you have set it use the ClearBodyText
rem - method (e.g. Mailer.ClearBodyText
rem
rem vbCrLf is a CR & LF combination (Carrage return/Line Feed)
rem
rem ------------------------------------
dim strBody
strBody = "Thank you for registering with JavaScripts R Us.!" & vbCrLf & VbCrLf
strBody = strBody & "We look forward to providing you with high quality scripts to enhance your websites!"
strBody = strBody & "Your user id for logging into this site is " & Request.Form("EMAIL_ADDR") & VbCrLf
strBody = strBody & "Your password is " & Request.Form("password") & VbCrLf
strBody = strBody & "You registered with the following information:"
strBody = strBody & Request.Form("FIRST_NM") & VbCrLf
strBody = strBody & Request.Form("LAST_NM") & VbCrLf
strBody = strBody & Request.Form("ADDR1") & VbCrLf
strBody = strBody & Request.Form("CITY_NM") & VbCrLf
strBody = strBody & Request.Form("ZIP_CD") & VbCrLf
strBody = strBody & Request.Form("EMAIL_ADDR") & VbCrLf
strBody = strBody & Request.Form("PASSWORD")
strBody = strBody & "You registered from IP address: "
strBody = strBody & "We look forward to having you as our customer!!!" & Now
rem
rem ClearBodyText erases the body just in case there is something in there...
rem
Mailer.ClearBodyText
rem
rem This assigns the string strBody to the BodyText property of the Mailer Object
rem
Mailer.BodyText = strBody
rem ------------------------------------
rem - Send the message
rem ------------------------------------
rem SendMail returns a true or false
rem
if Mailer.SendMail = True then
Response.Write "Mail sent..."
else
Response.Write "Mail failure. Check mail host server name and tcp/ip connection...<br>"
Response.Write Mailer.Response
end if
rem ------------------------------------
rem - Destroy the Email Object
rem ------------------------------------
Set Mailer = Nothing
%>
<H1>Thank You! <BR>
<BR>
Customer Registration Confirmation<BR>
</H1>
Thank you <TR><TD><% = Request.Form("FIRST_NM")%> for registering with us. You will receive an e-email at <% = Request.Form("EMAIL_ADDR")%></TR></TD>
confirming your registration shortly.
<BR>Have a nice day.
<P><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1 ></P>
<TR>
<TD>First Name:</TD>
<TD style='font-weight:bold;'><% = Request.Form("FIRST_NM")%></TD>
</TR>
<TR>
<TD>Last Name:</TD>
<TD style='font-weight:bold;'><% = Request.Form("LAST_NM")%></TD>
</TR>
<TR>
<TD>Address:</TD>
<TD style='font-weight:bold;'><% = Request.Form("ADDR1")%></TD>
</TR>
<TR>
<TD>City:</TD>
<TD style='font-weight:bold;'><% = Request.Form("CITY_NM")%></TD>
</TR>
<TR>
<TD>State:</TD>
<TD style='font-weight:bold;'><% = Request.Form("STATE_CD")%></TD>
</TR>
<TR>
<TD>Zip Code:</TD>
<TD style='font-weight:bold;'><% = Request.Form("ZIP_CD")%></TD>
</TR>
<TR>
<TD>E-Mail:</TD>
<TD style='font-weight:bold;'><% = Request.Form("EMAIL_ADDR")%></TD>
</TR>
<TR>
<TD>password:</TD>
<TD style='font-weight:bold;'><% = Request.Form("password")%></TD>
</TR>
<TR>
<TD>password confirm:</TD>
<TD style='font-weight:bold;'><% = Request.Form("password_confirm")%></TD>
</TR>
<TR><TD>
<UL TYPE="square">
<CENTER> <A HREF="register.asp">Registration Page</A> </TR></TD>
</UL>
</TABLE>
</BODY>
</HTML>
NOW HERE ARE THE EXAMPLES THAT I NEED TO INCLUDE IN MY REGISTRATIONCONFIRM.ASP PAGE:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE>Customer Add Sample</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
<%
'
' Declare an object variable
'
Dim objCustomer
'
' Declare variables
'
Dim cust_id, _
first_name, _
last_name, _
address, _
city_nm, _
state_cd, _
zip_cd, _
email_addr, _
phone_no, _
password, _
Error
'
' Give the variables a value
' One would normally retrieve the
' values from the Request.Form collection
'
cust_id = 0
first_name = "Bob"
last_name = "Jones"
address = "415 Fulton"
city_nm = "Grand Rapids"
state_cd = "MI"
zip_cd = "49505"
email_addr = "
[email protected]"
phone_no = "800-555-1212"
password = "password"
'
' Create an instance of Customer
' Customer is defined inside the include file
'
Set objCustomer = New Customer
Dim intRC, strPwd
'
' Call the add method of the customer object to
' add the customer to the database.
' cust_id will contain the customer ID if intRC is 1
' If intRC is zero, then there was an error
'
intRC = objCustomer.Add(cust_id, _
first_name, _
last_name, _
address, _
city_nm, _
state_cd, _
zip_cd, _
email_addr, _
phone_no, _
password, _
Error )
'
' Destroy the customer object once we are done with it.
'
If( intRC = 1 ) Then
Response.Write( "The newly registered customer ID is: " & cust_id & "<br />" )
'
' Get the password
'
strPwd = objCustomer.getPassword(email_addr, Error)
Response.Write(" <br />The customer's password is: " & strPwd)
Else
Response.Write( "Oops! There was an error: " & Error )
End If
Set objCustomer = Nothing
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 5.0">
</HEAD>
<BODY>
<title>Here is your e-mail confirmation</title><head>
<body>
<H3>Registration Complete</H3>
<%
AND
<%@ Language=VBScript %>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM Customer", Application("cnCISP310_DUO")
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
If( Not objRS.EOF ) Then
Response.Write("<TABLE BORDER=1>")
Response.Write("<TR><TD>ID</TD><TD>Name</TD><TD>E-MAIL</TD><TD>Password</TD><TD>Action</TD></TR>")
While not objRS.EOF %>
<TR>
<TD><% = objRS("cust_id").Value%></TD>
<TD><% = Trim(objRS("last_name").Value) & ", " & Trim(objRS("first_name").Value) %></TD>
<TD><% = objRS("email_addr").Value%></TD>
<TD><% = objRS("password").Value%></TD>
<TD><A href="deleteCustomer.asp?cust_id=<% = objRS("cust_id").Value%>"><% = "Delete!" %></A></TD>
</TR>
<%
objRS.MoveNext
Wend
Response.Write("</TABLE>")
Else
Response.Write("There are no customers to display!")
End If
%>
</BODY>
</HTML>
<%
objRS.Close
Set objRS = Nothing
%>
%>
PLEASE HELP ME TO MODIFY MY REGISTRATIONCONFIRM.ASP PAGE OR DIRECT ME SOMEWHERE FOR HELP
tHANKS