Here is my code, which returns:
Microsoft VBScript compilation error '800a03f6'
Expected 'End'
/content/postnewuser.asp, line 82
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/grat
isconn.asp
" -->
<%
'Always include the above file adovbs.inc. look up what is in there to understand why.
Dim strSQL, rsData, strFirstName, strLastName, strBirthdate, strCity_State, strTelephone, strEmail, strPassword
'We first collect the data from the form collection using the request method. We collect these fisrt into a variable so as we can validate if you need to do so. They can be collected and put straight into the database, but for now this way we can show clearly what is happening.
strFirstName = Request.Form("firstname")
strLastName = Request.Form("lastname")
strBirthdate = trim(Request.Form("dob"))
strCity_State = trim(Request.Form("address
"))
strTelephone = Request.Form("telephone")
strEmail = trim(Request.Form("email")
)
strPassword = trim(Request.Form("passwor
d"))
set rsData = Server.CreateObject("ADODB
.Recordset
")
'You need to amend the deatils below for your SQL server. This is a dsnless connection.
strSQL = "SELECT * FROM gratis_items WHERE gratis_items.email = '" & strEmail & "'"
rsData.Source = strSQL
rsData.CursorType = 2 'There a several cursor types, choose one which will let you do what you need to to the database. Look up cursor types and understand them.
rsData.LockType = 2 'Do you need exclusive use of the database? Look these up too and understand them
rsData.Open strSQL, conn ' Open database
%>
<%
Validated_Form = true
IF len(strEmail)<6 OR InStr(Form_Email,"@")=0 THEN
Validated_Form = false
END IF
IF len(strtelephone)<10 THEN
Validated_Form = false
END IF
IF len(strpassword)<6 THEN
Validated_Form = false
END IF
IF NOT Validated_Form THEN
%>
<HTML>
<BODY>
Error, please click your browser's back button and check your information. Email address must contain the @ symbol, your telephone number must be in the format of xxx-xxx-xxxx, and your password must be at least 6 characters. Please double check that all of these conditions are true.
</BODY>
</HTML>
<%
ELSE
%>
<%
If rsData.EOF Then ' If there is no records which fit he above SELECT criteria, then the email address must be a new one! So go ahead and create a new record.
rsData.AddNew ' Create a new record
rsData("firstname") = strFirstName
rsData("lastname") = strLastName
rsData("dob") = strBirthdate
rsData("address") = strCity_State
rsData("telephone") = strTelephone
rsData("email") = strEmail
rsData("password") = strPassword
session("emailaddy") = strEmail
session("password") = password
rsData.Update
rsData.Close ' Close the data connection
Set rsData = Nothing ' Always release the object to clean up the server
Response.redirect "../members/login.asp" ' A successful registration, send user to congrats page.
Else ' The email address has already been registered. Tell the user and send them back - Nothing has been saved to the database
%>
<SCRIPT language = "Javascript">
alert("Sorry, that email address exists in our system, please choose another");
window.history.back();
</SCRIPT>
<%
End If
%>
Start Free Trial