searching data using checkboxes
Posted: Sat Apr 05, 2008 11:55 pm
have values in two fields i want searched: *Pulmonary Pathology*Renal Pathology* (table.specialty) and *Chemical Pathology*Hematopathology* (table.subspecialty)
I'm trying to search these two fields using a large number of checkboxes using
if i search JUST Pulmonary Pathology or JUST Hematopathology i get my results, but if i search with terms that are NOT in the fields (Molecular Diagnostics) I get NO results.
Can someone show me how to get SOME of the data that's in a field using checkboxes... PLEASE? i've been on this all day...
my inputs look like:
<LI><INPUT type="checkbox" name="subspecialty[]" value="Chemical Pathology">Chemical Pathology
<LI><INPUT type="checkbox" name="subspecialty[]" value="Hematopathology">Hematopathology
Please help?
Thanks
GN
I'm trying to search these two fields using a large number of checkboxes using
Code: Select all
$checkbox1 = $_POST['specialty'];
$string1 = '*'.@implode('*',$checkbox1).'*';
$checkbox2 = $_POST['subspecialty'];
$string2 = '*'.@implode('*',$checkbox2).'*';
$sql="SELECT * FROM $tbl_user WHERE specialty LIKE '%$string1%' OR subspecialty LIKE '%$string2%' ORDER BY contact_name ASC";
Can someone show me how to get SOME of the data that's in a field using checkboxes... PLEASE? i've been on this all day...
my inputs look like:
<LI><INPUT type="checkbox" name="subspecialty[]" value="Chemical Pathology">Chemical Pathology
<LI><INPUT type="checkbox" name="subspecialty[]" value="Hematopathology">Hematopathology
Please help?
Thanks
GN