Forums
This topic is locked
Drop down search menu
20 Sep 2003 03:45:07 clue clue posted:
Hello everyone. i'm new to this forum and i'm in serious need of some php help. i'm building a site with a search engine. i got the search to work but i want the user to be able to search by different categories represented by a drop down menu. my guess is when they search any category, it will be that talbe in the databe is searched but i don't know how to set it up. dreamweaver is not helping me much on this issue, maybe someone can. any help would be much appreciated.-clue
Replies
Replied 22 Sep 2003 00:12:43
22 Sep 2003 00:12:43 Julio Taylor replied:
Hi,
Make your dorp menu with the options, using whatever text you want for the LABELS and the exact tablenames that you want to search as the VALUES.
You can set up your drop menu to represent a GET variable (e.g. 'varTable') which will send the VALUE (i.e. tablename) over to the results page.
In your results page, you can modify your query by doing your SQL like this:
SELECT * FROM varTable WHERE....
In your variables, set one up:
Name: Default: RunTime:
---------------------------------------------------------
varTable 0 $HTTP_GET_VARS["varTable"]
SO - you are dynamically choosing what table you are searching by using the name of the table sent over by your drop menu variable. So, whatever text you send, along with the tablename will help your SQL query search in the correct table.
Please let me know (julio at eliziumdesign.com) if you need more help.
I hope it helps!
------------------------
Julio
PHP | MySQL | DWMX
ICQ: 19735247
MSN:
Make your dorp menu with the options, using whatever text you want for the LABELS and the exact tablenames that you want to search as the VALUES.
You can set up your drop menu to represent a GET variable (e.g. 'varTable') which will send the VALUE (i.e. tablename) over to the results page.
In your results page, you can modify your query by doing your SQL like this:
SELECT * FROM varTable WHERE....
In your variables, set one up:
Name: Default: RunTime:
---------------------------------------------------------
varTable 0 $HTTP_GET_VARS["varTable"]
SO - you are dynamically choosing what table you are searching by using the name of the table sent over by your drop menu variable. So, whatever text you send, along with the tablename will help your SQL query search in the correct table.
Please let me know (julio at eliziumdesign.com) if you need more help.
I hope it helps!
------------------------
Julio
PHP | MySQL | DWMX
ICQ: 19735247
MSN: