Click to See Complete Forum and Search --> : Why Don't This Work


Calmaris
02-10-2003, 03:01 PM
HEY I DON'T UNDERSTAND WHY MY FORM DON'T SHOW UP. WHAT HAPPENS IS WHEN YOU CLICK ON THE LINK THE CODE IS RUN AND IT REDIRECTS TO THANKYOU.HTM OR USEREXISTS. WHY WON'T IT SHOW UP????????? I BELIEVE IF IF CAN GET BY THIS PROBLEM THE CODE WILL WORK. PLZ HELP

<% @Language = VBScript %>
<% Option Explicit %>



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>WELCOME TO THE REGISTRATION FORM</title>
</head>

<body background="REGISTRATIONBACKG.jpg">

<form method="Post" action="email.asp">
<p><img border="0" src="HUNTER%20REGISTRATIONPIC.gif" width="334" height="16"></p>
<p>HUNTER ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Id" size="20">&nbsp;&nbsp;<img border="0" src="deergun.gif" width="147" height="60"></p>
<p>
HUNTER PASSWORD <input type="text" name="Hunt_Password" size="20"></p>
<p>FIRST NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_First_Name" size="20">&nbsp;&nbsp;</p>
<p> LAST
NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Last_Name" size="20"></p>
<p>COUNTRY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Country" size="20">&nbsp;&nbsp;</p>
<p>
PROVINCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Province" size="20"></p>
<p>STATE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; <input type="text" name="Hunt_State" size="20"></p>
<p>City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_City" size="20"></p>
<p>Street
Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Street_Name" size="20"></p>
<p>Street
Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Street_Num" size="20"></p>
<p>Apartment Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="Hunt_Appt_Num" size="20"></p>
<p>Postal
Code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Postal" size="20"></p>
<p>Zip
Code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_zip" size="20"></p>
<p>Telephone Number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="Hunt_Telephone_Num" size="20"></p>
<p>WHAT IS YOUR FAVORITE ANIMAL TO HUNT&nbsp; <select size="1" name="FAV_HUNT">
<option>GOOSE</option>
<option>DUCK</option>
<option>DEER</option>
<option>MOOSE</option>
<option>BEAR</option>
<option>TURKEY</option>
</select></p>
<p>EMAIL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="Hunt_Email" size="20"></p>


<p><input type="submit" value="Submit" name="Submit"></p>
</form>
</body>

</html>
<%
'--------------------request the form elements and write to variables----------------------
Dim ObjMail, Hunt_Email, Hunt_First_Name, thebody, vbclf

Hunt_Email = request.form("Hunt_Email")
Hunt_First_Name = request.form("Hunt_First_Name")


'-------------------setup the CDONTS email object-------------------------------------
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
'------------------------Set the email elements------------------------------
ObjMail.To = ""& Hunt_Email &""
ObjMail.CC = ""& Hunt_Email &""
ObjMail.From = "NorthshoreAdventures@sympatico.com"
ObjMail.Subject = "You have registered"
thebody = "Name:"& Hunt_First_Name&"" & vbcrlf
'----------------create the body of the message------------------------
thebody = thebody & "Email: "& Hunt_Email &"" & vbclf
thebody = thebody & "Subject: "& Hunt_First_Name &""
ObjMail.Body = thebody
'----------------------send the message-----------------------------------
ObjMail.Send
Set ObjMail = Nothing

'---------------------insert the information into the database------------------------
%>
<%

Dim dbConn, dbQuery, recordsetDB, loginfound
Dim strHunt_Id, strHunt_Password, strHunt_First_Name
Dim strHunt_Last_Name,strHunt_Country,strHunt_Province
Dim strHunt_State,strFav_Hunt,strHunt_Email,strQueryString
Dim strHunt_City, strHunt_Street_Name, strHunt_Street_Num, strHunt_Appt_Num
Dim strHunt_Postal, strHunt_zip, strHunt_Telephone_Num, strquerystring1

If IsObject(Session("users_dbConn") ) Then
Set dbConn= Session("users_dbConn")
Else
Set dbConn = Server.CreateObject("ADODB.Connection")

Call dbConn.Open ("Appdb1","Anyone","Anyone")

Set Session("users_dbConn")= dbConn
End If
strHunt_Id = Request.Form("Hunt_Id")
strHunt_Password = Request.Form("Hunt_Password")
strHunt_First_Name = Request.Form("Hunt_First_Name")
strHunt_Last_Name = Request.Form("Hunt_Last_Name")
strHunt_Country = Request.Form("Hunt_Country")
strHunt_Province = Request.Form("Hunt_Province")
strHunt_State = Request.Form("Hunt_State")
strHunt_City = request.Form("Hunt_City")
strHunt_Street_Name =request.Form("Hunt_Street_Name")
strHunt_Street_Num = request.Form("Hunt_street_Num")
strHunt_Appt_Num = request.Form("Hunt_Appt_Num")
strHunt_Postal = request.Form("Hunt_Postal")
strHunt_zip = request.Form("Hunt_zip")
strHunt_Telephone_Num = request.Form("Hunt_Telephone_Num")
strFav_Hunt = Request.Form("Fav_Hunt")
strHunt_Email = Request.Form("Hunt_Email")
%>
<%
strquerystring1 = "SELECT Hunt_Registration.Hunt_Id " & _
"FROM Hunt_Registration " & _
"WHERE Hunt_Registration.Hunt_Id = " &" '" & strHunt_Id & "' "
set recordsetDB = dbconn.execute(strquerystring1)
%>
<%
if recordsetdb.eof then

strQueryString = "INSERT INTO Hunt_Registration (Hunt_Id,Hunt_password,Hunt_First_Name,Hunt_Last_Name,Hunt_Country, " & _
" Hunt_Province,Hunt_State, Hunt_City, Hunt_Street_Name, Hunt_Street_Num, Hunt_Appt_Num, Hunt_Postal, Hunt_Zip, Hunt_Telephone_Num, " & _
" Fav_Hunt,Hunt_Email)" & _
" VALUES ('" & strHunt_Id & "', '" & strHunt_Password & "', '" & strHunt_First_Name & "', '" & strHunt_Last_Name & "', " & _
" '" & strHunt_Country & "', '" & strHunt_Province & "'," & _
" '" & strHunt_State & "','" & strHunt_City & "','" & strHunt_Street_Name & "','" & strHunt_Street_Num & "','" & strHunt_Appt_Num & "', " & _
" '" & strHunt_Postal & "','" & strHunt_zip & "','" & strHunt_Telephone_Num & "', '" & strFav_Hunt & "', '" & strHunt_Email & "')"

Set recordsetDB = dbConn.Execute(strQueryString)
Set recordsetDB = Nothing
response.redirect("Thankyou.htm")
recordsetDB.Close
else
response.redirect("userexists.html")
end if
recordsetDB.Close

%>

Calmaris
02-10-2003, 03:54 PM
HEY I FIGURED IT OUT NOT THE WAY I WANTED TO BUT, HEY IT WORKS, I'M SO PROUD !! :D THANKS FOR THE CODE MAN