Within my HTML I have inserted a dropdown list and transfered three checkboxes from elsewhere in the page to under the column (the checkboxes enable/disable the dropdown). Within the ASP page (see below) I have the three checkoxes listed (I don't know if the function has to change or if it's correct). What is the code which would include the dropdown list selection? I have the three checkbox responses in bold.
Code:
' This function will display the results of the search
Private Sub ShowResults()
Dim strConn ' Database connection string
Dim SQL ' String that will have our SQL statments
Dim RS ' Recordset object
Dim Keyword ' Keyword for search
Dim nRecCount ' Number of records found
Dim nPageCount ' Number of pages of records we have
Dim nPage ' Current page number
Dim iCounter 'for the checkboxes
Dim iLoopCount
Dim aRecTypes
' Let's see what page are we looking at right now
nPage = CLng(Request.QueryString("Page"))
' Let's see what user wants to search for today :)
Keyword = Trim(Request.QueryString("Keyword"))
' define our SQL statment
' we will be looking for all the records in tblItem table
' where ItemName contains our Keyword
' do not forget to fix tick marks (single quotes) in our Keyword
SQL = "SELECT * FROM bible WHERE "
' Create our connection string
strConn = GetConnectionString()
Response.Write request.QueryString("book")
If request.QueryString("book")="Book" then
Sql = Sql & "book LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("book_spoke")="Book_Spoke" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "book_spoke LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("book_title")="Book_Title" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "book_title LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("chapter")="Chapter" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "chapter LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("chapter_spoke")="Chapter_Spoke" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "chapter_spoke LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("verse")="Verse" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "verse LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("verse_spoke")="Verse_Spoke" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "verse_spoke LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If request.QueryString("text_data")="Text" then
If iCounter > 0 Then
Sql = Sql & " AND "
End If
Sql = Sql & "text_data LIKE '%" & Keyword & "%'"
iCounter = iCounter + 1
end if
If Trim(Request.QueryString("recordType")) <> "" Then
aRecTypes = Split(Request.QueryString("recordType"), ",")
If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
SQL = SQL & " AND ("
For iLoopCount = 0 To UBound(aRecTypes)
If iLoopCount <> 0 Then
SQL = SQL & " OR "
End If
SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
Next
End If
SQL = SQL & ")"
End If