I am using the
Macromedia Ultradev 4 to create my
ASP page..
In the software, there is a built in function that we can used to validate our form especially the "username validation"
here is the code...
- Code: Select all
<%
' *** Redirect if username exists
MM_flag="MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
MM_dupKeyRedirect="admin/usernameAdminExist.asp"
MM_rsKeyConnection=MM_AdminRegister_STRING
MM_dupKeyUsernameValue = CStr(Request.Form("username"))
MM_dupKeySQL="SELECT username FROM userlist WHERE username='" & MM_dupKeyUsernameValue & "'"
MM_adodbRecordset="ADODB.Recordset"
set MM_rsKey=Server.CreateObject(MM_adodbRecordset)
MM_rsKey.ActiveConnection=MM_rsKeyConnection
MM_rsKey.Source=MM_dupKeySQL
MM_rsKey.CursorType=0
MM_rsKey.CursorLocation=2
MM_rsKey.LockType=3
MM_rsKey.Open
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
' the username was found - can not add the requested username
MM_qsChar = "?"
If (InStr(1,MM_dupKeyRedirect,"?") >= 1) Then MM_qsChar = "&"
MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
End If
MM_rsKey.Close
End If
%>
this code will check a field in my form which is the "username" field and then redirect the page to another page if the username was found in my database..
- Code: Select all
MM_dupKeyRedirect="admin/usernameAdminExist.asp"
What I want to do is to
modify this code so that it can check
more that one parameter, in this case it is the username only! I want to check maybe the
studentID field and the
DOB field. This field is the primary key inside my database for example.
<span style="color:blue">
Can anybody help me to modify this code...?</span id="blue">