I am attempting to create an asp page where the user will sign a guest book. The page then validates the required fields, sends the information to the database and e-mails me the information to let me know a new entry has been inserted. I am doing this on brinkster and the only error message I get is "There is a problem with the page you are trying to reach and it cannot be displayed."
Here is my code--
<%@ Language=VBScript %>
<%
if isempty(Request.Form("Submit")) then
'initial message to the user
'listed in html part
TheMessage1 = "Please use the form below to sign my guestbook."
TheMessage2 = "Note that fields with * are required."
else
'temporary variables to hold the data
theName = Request.Form("theName")
Email = Request.Form("Email")
Location = Request.Form("Location")
Comments = Request.Form("Comments")
'check validation of Name
if isempty (Request.Form("theName")) or Request.Form("theName") = "" then
TheMessage1 = "The form was not submitted."
TheMessage2 = "Name is required!"
'check validation of email
elseif isempty(Request.Form("Email")) or Request.Form("Email") = "" then
TheMessage1 = "The form was not submitted."
TheMessage2 = "Email Address is required!"
elseif instr(Request.Form("Email", "@") = 0 or instr(Request.Form("Email"), ".") = 0 then
TheMessage1 = "The form was not submitted."
TheMessage2 = "Email address is invalid!"
end if
'connect to the database
set MyConn = Server.CreateObject ("ADODB.Connection")
MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("\nvillare\db\nidia.mdb"))
'form has been submitted
ThanksMessage = "Thanks " & _
ThanksMessage = ThanksMessage & theName & _
ThanksMessage = ThanksMessage & "for signing my guestbook!"
TheMessage1 = cstr(ThanksMessage)
TheMessage2 = "Your entry will be reviewed prior to posting."
'combine the message to send to my email address
EmailMessage = "Sign-In entry to be reviewed for posting:" &
'13 creates a new line in the message
chr(13) & chr(13)
EmailMessage = EmailMessage & "Name: " & theName & chr(13)
EmailMessage = EmailMessage & "Email Address: " & Email & chr(13)
EmailMessage = EmailMessage & "Location: " & Location & chr(13)
EmailMessage = EmailMessage & "Comments: " & Comments & chr(13)
'set connection to email the message
set objMail = CreateObject("CDNTS.NewMail")
'send message to my email address
'parameter is to who, from, subject, message
objMail.Send "
[email protected]", Request.Form("Email"), _
"New Entry into the GuestBook!", cstr(EmailMessage)
'destroy the objMail
set objMail = nothing
'insert data into the database
MySQL = "INSERT INTO SignIn (theDate, theName, Email, Location, Comments)"
MySQL = MySQL & " VALUES ('" & Now() & "','"
MySQL = MySQL & theName &"','"
MySQL = MySQL & Email &"','"
MySQl = MySQL & Location &"','"
MySQL = MySQL & Comments &"')"
MyConn.Execute(MySQL)
MyConn.Close()
MyConn = null
%>
Any help os greatly appreciated!
Thanks!
Nidia