Forums
This topic is locked
Using a dropdown field in a search
Posted 14 Oct 2003 21:16:28
1
has voted
14 Oct 2003 21:16:28 Dan Berdusco posted:
Please excuse me if a similar question has already been posted in another forum. I searched but could not find anything.<b>Here is my question:</b>
I want to perform a search based on form variables. One of the form variables is a dropdown menu. The menu is polulated dynamically from a database with CategoryName (text) as the label and CategoryID (autonumber) as the value. I would like to have an option in the menu that will allow the user to "search all" the categories. I am not sure how to do this because of the autonumber value? What is the value that I need to have in the Dropdown Menu for the "Show all" label? What kind of an SQL statement do I need to have on the results page to show all of the categories?
Any help is appreciated.
Replies
Replied 31 Oct 2003 23:21:50
31 Oct 2003 23:21:50 Dan Berdusco replied:
I <b>REALLY</b> need to figure out how this is done.... Can <b>ANYONE</b> help???
Replied 01 Nov 2003 09:41:09
01 Nov 2003 09:41:09 Dave Clarke replied:
Hi
I have the value % in my drop-down list for the 'show all' option.
Your SQL would be something like this.
<b>SELECT *
FROM Messages
WHERE Category LIKE 'MMColParam' </b>
MMColParam would be <b>Request("cat"
</b> where cat is the name of the form field for your drop-down. The default value for MMColParam would be %
hope this helps
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
I have the value % in my drop-down list for the 'show all' option.
Your SQL would be something like this.
<b>SELECT *
FROM Messages
WHERE Category LIKE 'MMColParam' </b>
MMColParam would be <b>Request("cat"

hope this helps
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 01 Nov 2003 23:30:09
01 Nov 2003 23:30:09 Janusz Jasinski replied:
Try:
www.macromedia.com/support/dreamweaver/
some good tutorials there... maybe this one?
www.macromedia.com/support/ultradev/building/simple_search_feature/
I have done this with multiple dropdowns, all getting data dynamically with every option depending on the other one.... i.e.
Option1 filters values for 2, 3 and 4, etc
Janusz
======================
janusz.monkey-it.co.uk
www.macromedia.com/support/dreamweaver/
some good tutorials there... maybe this one?
www.macromedia.com/support/ultradev/building/simple_search_feature/
I have done this with multiple dropdowns, all getting data dynamically with every option depending on the other one.... i.e.
Option1 filters values for 2, 3 and 4, etc
Janusz
======================
janusz.monkey-it.co.uk
Replied 02 Nov 2003 03:58:11
02 Nov 2003 03:58:11 Dan Berdusco replied:
Davecl, I have created several searches using the % as a wildcard type character. However, I cannot use it in this situation... The values in my dropdown list are populated with numbers. For example the label for the dropdown menu might be "Computer" but the value is "24". When I perform the search, I am seraching for a number 24, not the word "Computer". Therefore, I cannot use "LIKE" in the SQL Statement because then, if I searched for a value of 24, it would also find the value, 240, 244, 2400, 245, etc. From what I can see, it is totally different when you are dealing with numbers.
Replied 02 Nov 2003 06:53:20
02 Nov 2003 06:53:20 Dave Clarke replied:
mmmm
never used numbers but surely if you used = instead of LIKE then it would only find your number 24 if that was what you selected and find all entries if you selected %
like i said ive never tried it but you never know
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
never used numbers but surely if you used = instead of LIKE then it would only find your number 24 if that was what you selected and find all entries if you selected %
like i said ive never tried it but you never know
Dave
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome
Replied 02 Nov 2003 21:14:54
02 Nov 2003 21:14:54 Janusz Jasinski replied:
U use ASP for this one.... well ahd no choice and I just used the ASP wildcard thingy...
<pre id=code><font face=courier size=2 id=code><% dim wildcard
wildcard = "%"
%> </font id=code></pre id=code>
and then.....
<pre id=code><font face=courier size=2 id=code>OPT-ION value="<%= wildcard %>"> /OPT-ION </font id=code></pre id=code>
OPT-ION = <option, but wouldn't format properly in this forum....
Janusz
======================
janusz.monkey-it.co.uk
ASP | VBScript | IIS 5.1 | Windows XP Pro | Linux Redhat 9 | SuSE 9 Pro | Linux FreeBSD 4.9 | PHP 5.0.0 Beta 2 | MySQL 4.0 | Apache 2.0.48 | Macromedia Studio w/t Flash 2004 | Microsoft Office Pro 2003 | Mozilla Firebird 0.7 | IE 6 | B.O.R.E.D @ HoMe
<pre id=code><font face=courier size=2 id=code><% dim wildcard
wildcard = "%"
%> </font id=code></pre id=code>
and then.....
<pre id=code><font face=courier size=2 id=code>OPT-ION value="<%= wildcard %>"> /OPT-ION </font id=code></pre id=code>
OPT-ION = <option, but wouldn't format properly in this forum....
Janusz
======================
janusz.monkey-it.co.uk
ASP | VBScript | IIS 5.1 | Windows XP Pro | Linux Redhat 9 | SuSE 9 Pro | Linux FreeBSD 4.9 | PHP 5.0.0 Beta 2 | MySQL 4.0 | Apache 2.0.48 | Macromedia Studio w/t Flash 2004 | Microsoft Office Pro 2003 | Mozilla Firebird 0.7 | IE 6 | B.O.R.E.D @ HoMe