kuau
08-12-2008, 03:33 AM
I am creating a search form and have most of it working, but for the section on searching by category I don't know how to retrieve the values from the selected checkboxes. Users can choose up to 39 possible categories but how do I create a where clause for an indeterminate number of selections? They might choose 10, or none. I thought I almost had it but realized my original plan would not work. I figure there must be a loop involved but don't know where to put it. This is as far as I can get so far... sorry, there's something about arrays and loops that I haven't quite grasped yet. Any help would be greatly appreciated. Thanks! e :)
" AND event_id IN (SELECT event_id FROM eventcat WHERE cat_id = x1 OR cat_id = x2 OR cat_id = x3 etc ";
This is the code in the search form that seems to correctly list the category checkboxes:
echo '<td width="253"><input type="checkbox" name="cats[]" value="'.$row['cat_id'].'">' .$row['category'].'</td>';
" AND event_id IN (SELECT event_id FROM eventcat WHERE cat_id = x1 OR cat_id = x2 OR cat_id = x3 etc ";
This is the code in the search form that seems to correctly list the category checkboxes:
echo '<td width="253"><input type="checkbox" name="cats[]" value="'.$row['cat_id'].'">' .$row['category'].'</td>';