Click to See Complete Forum and Search --> : more than 1 choice criteria in search box


jleiker
06-11-2003, 09:43 AM
Hi there!
I have a rather long page...main thing is they can search by radio button:company code or radio button company name....type their search txt in after choosing one and hit search button. Displays data from that found record...
Now I need to add a choice for a field called country. So they can choose both company code/ and the country they want and search both. OR choose company name and the country and search both of those. Only three countrys we need: us, canada and ins. Could it be a drop down? I have no idea how to put this in my code. Here is what I have if anyone could guide me?

------------------------------------------------------<html>
<% language="vbscript"%>
<head>
<META HTTP-EQUIV="expires" Content="-1">
<title>CodeBook</title>

<%
dim variables here....


Password=Session("password")
Username=Session("username")
searchByName = False

searchType = Trim(Request.QueryString("type"))
If searchType = "C" Then
searchColumn = "txtcode"
Else
searchColumn = "txtname"
searchByName = True
End If
searchValue = Trim(Request.QueryString("value"))
codetxt = Trim(Request.QueryString("id"))

Set conn = Server.CreateObject("ADODB.Connection")
conn.connectionstring etc.... conn.open

sql="select * from codebook" &_
" where " & searchColumn & " Like '" & searchValue & "%'" &_
" order by " & searchColumn

Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql, conn
%>
<SCRIPT type="text/javascript" language="javascript">
selectionType = '<%Response.Write searchType%>';
selectionSearch = false;
selectionChanged = false;
function checkForUpdate() {
changeMade = false;
if (selectionChanged || selectionSearch) {
valueObj = document.getElementById("searchvalue");
idObj = document.getElementById("id");
newOptions = '';
if (idObj.value != '') { newOptions += 'id=' + idObj.value; }
if (valueObj.value != '') {
if (newOptions > '') { newOptions += '&'; }
newOptions += 'type=' + selectionType + '&value=' + valueObj.value;
}
window.location.href = 'codebook.asp?' + newOptions;
}
}
</SCRIPT>
</head>
<BODY>
>
<input type=radio name=searchtype id=searchtxtcode1 onclick="selectionType=this.value;" value="C"
<%
If not searchByName Then Response.Write " checked"
%>
</font></u>Company Code<u><input type=radio name=searchtype id=searchname2 onclick="selectionType=this.value;" value="N"
<%
If searchByName Then Response.Write " checked"
%>
</font></u>Company Name</font></b><font face="new times roman"> <b>&nbsp;</b><Form>

<b>
<input name=searchvalue id=searchvalue1 size=21 value="<%Response.Write searchValue%
<button onclick="selectionSearch=true;checkForUpdate();">
left" valign="top" width="443" rowspan="2">
<SELECT name=id id=id0 size=2 style="height:742; float:left; width:742; font-size:10px; margin-top:1; margin-bottom:1" onchange="selectionChanged=true;checkForUpdate(this.value);">
<%
Do While Not rs.EOF
workID = Trim(rs("ID"))
Response.Write "<Option style=""overflow:scroll"" value=""" & workID & """"
If workID = codetxt Then

End If
%>
<%
Response.Write "<option value=1>" &"____________________________________________________________________________________________________ _________________________________"&"</option>" &"<option value=2>"&rs("txtcode") & " - "&rs("txtname")& "</option>"& "<option value=3>" & rs("txtcountry") &"</Option>"& "<option value=5>" & rs("txtcity") & ", " & rs("txtstate") & "- "& rs("txtzip") & "<option value=6>" & rs("txtinstype")&"</option>"&"<option value=7>" & rs("txtaffiliation") & "</option>"& "<option value=8>" & rs("txtsamea")&"</Option>"


rs.MoveNext
%>
<%
Loop
%>
<%
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
%>
</SELECT>
</font></TD>

</Form>

</TABLE>
</div>
</body>
</html>