Two pieces of code, need to combine to get search box and checkbox working

Hi all,
I’m trying to get a search box and a checkbox to both work at the same time. I have two versions of this code, when I use the first one my checkbox works like it should, filtering out all records with product_type = 3, but the search bar no longer works as it should, filtering things out of three fields defined elsewhere. The bottom code has the search bar working but doesnt incorporate the checkbox as a filter. Thanks for any help!

Checkbox works:

$where_filter = ""; if($where != "*"){ foreach($search_map as $search_name){ $where_filter .=" $op $search_name $not REGEXP '$where'"; } $where_filter = substr($where_filter, 5)." AND "; } if ($exclude == "exclude"){ $where_filter .= "product_type!='3'"; $q->addWhere("($where_filter)"); $q->addOrder('product_id'); }

Search works:

[code]$where_filter = " “;
foreach($search_map as $search_name)
$where_filter .=” $op $search_name $not REGEXP ‘$where’";
$where_filter = substr($where_filter, 5);

if($where != "*")
   $q->addWhere("($where_filter)");
$q->addOrder('product_id');[/code]

update: actually what is happening is the search box is only working when the checkbox is checked too

Sponsor our Newsletter | Privacy Policy | Terms of Service