Hi Everyone,

I got two parts of my advance search to work, I am running out of Logic to
connect the third. My mind is in swing! Pleaseeeeeeeee Help me.

I have 3 Fiels to search, the First two works, thats:

1. Category to search from the (Drop down name: ASPDBCatSearch) is working
with the Input Text Box Field (name: keyword), based on Whatever selection on
the Drop down value selection:
The "Option Value" FirstName,Title,Email etc... is connected to the Input
Text Box Field (name: keyword) with the asp code thus:

' HTML Drop down Name | FirstName is the value name

If Request.Form("ASPDBCatSearch") = "FirstName" Then

' HTML Input Text Box name is keyword

SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keyword") & "%'
"
End If

The rest values based on selection works with the Keyword typing.

>>>>> My Question is: I have added another drop Down Call salary (name: Salarycom), I need to add that to the Search Logic, and I am lost, How can I do this please?

In Breiaf How can I connect the "Salary Drop down Values" to the Category
Search drop down + and the Input txt box Search to match the Exact Search?

Can Some one Give me two sentences of example with my above Added code as to
how the salary values should be added to the Category and Input txt box
fields in the asp code?

------------------------------------------------------------------------------


The html Code:


<table border="0" width="525" bgcolor="#FFFFFF" cellspacing="3"
cellpadding="3"
style="border: 0px outset #EEEEEE; ">
<tr>
<td width="515" bgcolor="#FFFFFF"><form action="Searchengineresults.asp"
method="post" align="center">

<div align="center"><center>
<table border="1" width="486" cellpadding="3"
bgcolor="#F5F5F5" bordercolorlight="#EEEEEE" style="border-collapse:
collapse">
<tr>
<td align="left" width="169"><strong><font face="Tahoma"><big><big>
<font size="1">1.</font></big></big><font size="1"> Select a category to
search</font></font></strong><p align="center"><select
name="ASPDBCatSearch" size="1">
<option selected value="All">All</option>
<option value="FirstName">First Name</option>
<option value="LastName">Last Name </option>
<option value="Title">Title </option>
<option value="Division">Dept/Div </option>
<option value="Phone">Phone </option>
<option value="Email">E-Mail </option>
</select></td>
<td align="left" width="106" bgcolor="#FF870F"><strong><font
face="Tahoma"><big><big>
<font size="1">2.</font></big></big><font size="1">
Salary</font></font></strong><p>
<select name="Salarycom" size="1">
<option selected value="Allsal">All</option>
<option value="10000">10000</option>
<option value="20000">20000</option>
<option value="30000">30000</option>
<option value="40000">30000</option>
<option value="50000">50000</option>
<option value="60000">60000</option>
<option value="70000">70000</option>
<option value="80000">80000</option>
<option value="90000">90000</option>

<option value="100000 or Abv">100000 or Abv</option>

</select></td>
<td width="172" align="right">
<p align="center"><strong><font face="Tahoma"><big><big>
<font size="1">3.</font></big></big><font size="1"> Type search
criteria</font></font></strong><p>
<input type="text" size="30" name="keyword"></td>
</tr>
<tr>
<td colspan="3" align="center" width="478">
<p><input type="reset" name="B2" value="Clear">
<input type="submit" name="B1" value="Search employees"></td>
</tr>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>

</body>
</html>

------------------------------------------------------------------------------
---------------------

ASP Code Searchengineresults.asp


<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject("ADODB.Connection")
aspdbweb = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath
("employees.mdb") & ";"

SQL = "SELECT * FROM Employees"

' An Example on Salary Drop down Values to connect to the rest two (Category
and Input txt Box) please here will be appreciated


If Request.Form("ASPDBCatSearch") = "FirstName" Then
SQL = SQL & " WHERE FirstName LIKE '%" & Request.Form("keyword") & "%' "
End If

If Request.Form("ASPDBCatSearch") = "LastName" Then
SQL = SQL & " WHERE LastName LIKE '%" & Request.Form("keyword") & "%'"
End If

If Request.Form("ASPDBCatSearch") = "Title" Then
SQL = SQL & " WHERE Title LIKE '%" & Request.Form("keyword") & "%'"
End If

If Request.Form("ASPDBCatSearch") = "Division" Then
SQL = SQL & " WHERE Division LIKE '%" & Request.Form("keyword") & "%'"
End If

If Request.Form("ASPDBCatSearch") = "Phone" Then
SQL = SQL & " WHERE Phone LIKE '%" & Request.Form("keyword") & "%'"
End If

If Request.Form("ASPDBCatSearch") = "Email" Then
SQL = SQL & " WHERE EMail LIKE '%" & Request.Form("keyword") & "%'"
End If

Set rsglobal = Server.CreateObject("ADODB.Recordset")
rsglobal.Open SQL, aspdbweb, 3
%>
<%
If rsglobal.BOF and rsglobal.EOF Then%>

<h2 align="center">We did not find a match!</h2>
<%Else%>


<%If Not rsglobal.BOF Then%>

<h2>Here are the results of your search:</h2>

<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">First name </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Last Name </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Salary </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Title </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Division </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Phone </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">E-Mail </font></span></th>
</tr>
<%
Do While Not rsglobal.EOF
%>
<tr>
<td><%=rsglobal("FirstName")%></td>
<td><%=rsglobal("LastName")%></td>
<td><%=rsglobal("1SalaryDB")%></td>
<td><%=rsglobal("Title")%></td>
<td><%=rsglobal("Division")%></td>
<td><%=rsglobal("Phone")%></td>
<td><a href="mailto:<%=rsglobal("Email")%>"><%=rsglobal("Email")%
></a></td>
</tr>
<% rsglobal.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsglobal.Close
%>
</body>
</html>

--------------------------------------------------------

Awaiting your favorable reply.

Thank you.

RE: Please Help Advanse Search, two parts are working, the 3rd to conn by OldPedant

OldPedant
Thu Aug 21 14:32:12 CDT 2008


First, change your options for the salary to this:

<select name="Salarycom" size="1">
<option selected value="">All</option>
<option value="BETWEEN 0 AND 10000">10000</option>
<option value="BETWEEN 10001 AND 20000">20000</option>
<option value="BETWEEN 20001 AND 30000">30000</option>
<option value="BETWEEN 30001 AND 40000">30000</option>
<option value="BETWEEN 40001 AND 50000">50000</option>
<option value="BETWEEN 50001 AND 60000">60000</option>
<option value="BETWEEN 60001 AND 70000">70000</option>
<option value="BETWEEN 70001 AND 80000">80000</option>
<option value="BETWEEN 80001 AND 90000">90000</option>
<option value="> 100000 or Abv">100000 or Abv</option>
</select>



<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>