View Single Post
  #1  
Old 04-29-2003, 08:16 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default Searching Extra Fields

Now I need to add to the Advanced search page - I will have a drop down box with a list of values that may be found in ANY of the extra fields. So, I want to add the value selected to the advanced search.

The problem is that I think the values assigned in the <Select> drop down list need to be passed through smarty (?) somehow and then I would add this to the query:


Code:
$search_ef_condition = " AND ($sql_tbl[products].param01 like '%$ef_search%' or $sql_tbl[products].param02 like '%$ef_search%' or $sql_tbl[products].param03 like '%$ef_search%' or $sql_tbl[products].param04 like '%$ef_search%' or $sql_tbl[products].param05 like '%$ef_search%' or $sql_tbl[products].param06 like '%$ef_search%' or $sql_tbl[products].param07 like '%$ef_search%' or $sql_tbl[products].param08 like '%$ef_search%') "

(Note: I am skipping param00 and param09 intentionally)
$ef_search would be the value of what was selected in the drop-down, but HOW do I get it to pick up the value from the <select> box?? The drop down looks something like this:
Code:
<select class="combobox" name="ef_search" size="1"> <option value=""> </option> <option value="choice1">choice1</option> <option value="choice2">choice2</option> <option value="choice3">choice3</option> <option value="choice4">choice4</option> <option value="choice5">choice5</option> </select>
There's actually 15 or 20 choices in the drop down and they are hardcoded in there and they won't change.

And I modified the $search_query to include the $search_ef_condition:
Code:
$search_query = "($sql_tbl[products].product like '%$substring%' or $sql_tbl[products].descr like '%$substring%') and $sql_tbl[categories].category like '$search_category%' and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $search_ef_condition $price_condition ";

It's looking like I'm in over my head, but I feel I am close. Any ideas? Am I going about this the wrong way? You see what I am wanting to add to the query - Search all of the param0x fields for a value that was selected from the drop down added to the advanced search page.

Help?
Reply With Quote