jrthor2
04-16-2003, 01:59 PM
I have a form that submits to the following page:
<%
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
If Trim(Request.Form("LastName")) = "" Then
Response.write "<b>Please enter a Last Name.</b><br>"
End If
If Trim(Request.Form("FirstName")) = "" Then
Response.write "<b>Please enter a First Name.</b><br>"
End If
Set conn = server.createobject("adodb.connection")
DSNtemp="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("members.mdb")
conn.Open DSNtemp
SQLstmt = "INSERT INTO MemberList (LastName,FirstName,Address1, Address2,CityState,Zip)"
SQLstmt = SQLstmt & " VALUES ('" & request.form("LastName") & "','" & request.form("FirstName") & "','" & request.form("Address1") & "','" & request.form("Address2") & "','" & request.form("CityState") & "','" & request.form("Zip") & "')"
%>
<%
conn.execute(SQLstmt)
conn.Close
Set conn = nothing
Set SQLstmt = nothing
Response.Redirect("index.asp?name=" & Request.Form("name"))
%>
If I don't enter a last name or first name, it still submits the row, it doesn't give me the error that you must enter that field. What is wrong here?
Thanks
<%
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
If Trim(Request.Form("LastName")) = "" Then
Response.write "<b>Please enter a Last Name.</b><br>"
End If
If Trim(Request.Form("FirstName")) = "" Then
Response.write "<b>Please enter a First Name.</b><br>"
End If
Set conn = server.createobject("adodb.connection")
DSNtemp="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("members.mdb")
conn.Open DSNtemp
SQLstmt = "INSERT INTO MemberList (LastName,FirstName,Address1, Address2,CityState,Zip)"
SQLstmt = SQLstmt & " VALUES ('" & request.form("LastName") & "','" & request.form("FirstName") & "','" & request.form("Address1") & "','" & request.form("Address2") & "','" & request.form("CityState") & "','" & request.form("Zip") & "')"
%>
<%
conn.execute(SQLstmt)
conn.Close
Set conn = nothing
Set SQLstmt = nothing
Response.Redirect("index.asp?name=" & Request.Form("name"))
%>
If I don't enter a last name or first name, it still submits the row, it doesn't give me the error that you must enter that field. What is wrong here?
Thanks