Current location: Hot Scripts Forums » Programming Languages » ASP » Dropdown Search Box


Dropdown Search Box

Reply
  #1 (permalink)  
Old 09-15-04, 05:34 PM
rainman123 rainman123 is offline
New Member
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Dropdown Search Box

I have created a asp form with two dropdown selections boxes. One for Category and the other for manufacturer. These fields are in two different tables in an access database. I have hardcoded the manufacturers and some categories in the form to test it. The for does not seem to work. Can someone give me some help or tell me where to find a script that will help.

Thanks code is below.. Brian

<body bgcolor="#FFFFFF">
<table width="62%" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3">
<form method="post" action="search2.asp">
<input type="hidden" name="posted" value="1">
<tr align="RIGHT" valign="MIDDLE">
<td width=116><font size="2" face="Georgia, Times New Roman, Times, serif" color="#0066CC">Fast
Find>>></font></td>
<td width="5"> </td>
<td width="122" bgcolor="#FFFFFF">
<select name="pBrand" class='inputboxes'>
<option value="">All Manufacturers</option>
<option value="3">Coleman</option>
<option value="2">Sunbeam</option>
</select>
</td>
<td width="6"> </td>
<td width="136" bgcolor="#FFFFFF">
<select name="pSection" class='inputboxes'>
<option value="">All Categories</option>
<option value="12">Tents</option>
<option value="44">Sleeping bags</option>
<option value="33">Telecopes</option>
<option value="19">Clocks</option>
</select>
</td>
<td bgcolor="#FFFFFF" colspan="3" width="51">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td bgcolor="#FFFFFF" width="5%" align="center">
<input type="submit" value="GO" name="submit">
</td>
</tr>
</table>ks
Reply With Quote
  #2 (permalink)  
Old 09-17-04, 11:56 AM
Naresh Rohra Naresh Rohra is offline
Newbie Coder
 
Join Date: Jun 2004
Location: India
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Code Logic:

Your Form file: Search.htm

Code:
<%@LANGUAGE = "VBScript"%>

<% Option Explicit %>
<% Include Virtual=

<BODY BGCOLOR="#FFFFFF">
	<%

		Dim objRsMFC, objRsCtg, objConn, Dim MfcCount
		Set objConn = Server.CreateObject("ADODB.Connection")
		Set objRsMFC = Server.CreateObject("ADODB.Recordset")  '*** For Manufacturers
		Set objRsCtg = Server.CreateObject("ADODB.Recordset")  '*** For Categories

		objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = c:\Customer.mdb"
		objConn.open		'*** Open connnection

		'*** Retrieve records from Tables

		objRsMFC.Open "Manufacturers", objConn, adOpenDynamic, adLockOptimisstic, adCmdTable
		objRsMFC.Open "Categories", objConn, adOpenDynamic, adLockOptimisstic, adCmdTable	
	%>

	<TABLE WIDTH="62%" BORDER="0" BORDERCOLOR="#B1B1B1" CELLSPACING="1" CELLPEDDING="3">
		<FORM METHOD="post" ACTION="search2.asp">

		<INPUT TYPE="hidden" NAME="posted" VALUE="1">
		<TR ALIGN="Right" VALIGN="Middle"> 

			<TD WIDTH=116><FONT SIZE="2" FACE="Georgia, Times New Roman, Times, serif" COLOR="#0066CC">Fast 
			Find>>>       </FONT>
			</TD>

			<TD WIDTH="5"> </TD>

			<TD WIDTH="122" BGCOLOR="#FFFFFF"> 

				<SELECT NAME="pBrand" CLASS='inputboxes'>
					<%
						<OPTION VALUE="">" All Manufacturers </OPTION> '*** Hope this is not in the table 
								'*** so i am writing as hardcoded

					  	While Not objRsMfc.EFO 	'*** Fetch record from database: 
									'*** Value and mfc are fields where Value=1, 2, 3... and Mfc=Sunbeam ... 
							Response.Write("<OPTION VALUE=" & <%= objRsMfc("Value") %> & ">" & objRsMfc("Mfc") & "</OPTION>")  	
							objRsMfc.MoveNext
						Wend	
					%>
				</SELECT>
			</TD>
			<TD WIDTH="6"> </TD>

			<TD WIDTH="136" BGCOLOR="#FFFFFF"> 
				<SELECT NAME="pSection" CLASS='inputboxes'>
					<%
						<OPTION VALUE="">" All Categories </OPTION> '*** Hope this is not in the table 
								'*** so I am writing as hardcoded

					  	While Not objRsCat.EFO 	'*** Fetch record from database: 
									'*** Value and Cat are fields where Value= 13, 23, 33... and Cat= Sleeping bags, ... 
							Response.Write("<OPTION VALUE=" & <%= objRsMfc("Value") %> & ">" & objRsMfc("Cat") & "</OPTION>")  	
							objRsMfc.MoveNext
						Wend	
						objRsMfc.Close
						objRsCat.Close	
						objConn.Close
						Set objRsMfc = Nothing
						Set objRsCat = Nothing
						Set objConn = Nothing 
					%>
				</SELECT>
			</TD>
			
			<TD BGCOLOR="#FFFFFF" COLSPAN="3" WIDTH="51"> 
				<TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDER="0">
					<TR>
						<TD BGCOLOR="#FFFFFF" WIDTH="5%" ALIGN="center"> 
						<INPUT TYPE="submit" VALUE="GO" NAME="submit">
						</TD>
					</TD> 
				</TABLE>
			</TD>
		</FORM>
		</TR>
	<TABLE>
</BODY>
I don't have PWS isntalled over here. Although the logic is correct, just check out with the syntax error(s) (If any). Hope this helps.

Cheers.
Naresh.
Reply With Quote
  #3 (permalink)  
Old 09-17-04, 01:56 PM
alexsaves alexsaves is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
DHTML Combo

EBA has a new DHTML combo search box. Combobox http://developer.ebusiness-apps.com

---------
ASP Grid Control - http://www.aspgrids.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SEO Expert Available nakulgoyal Job Offers & Assistance 2 08-14-04 12:38 PM
Shout box, comment box, or search script. Need help to find all! Spreegem Script Requests 1 05-29-04 09:45 PM
Simple search script niceguyonline Script Requests 3 03-07-04 11:09 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 03:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.