I currently have a checkbox-based search that has two arrays, 'rank' and 'area', where rank has seven options and area has three. As long as a user selects at least one value for rank and one for area, the search works fine. I would like to set the search so that if all the checkboxes are left blank in an array, it will return all results for that array. For example, if nothing is checked in rank but "creative writing" is checked in area, all creative writers regardless of their rank will be returned.
I don't know that this is the best way to do what I'm already doing, but the code I am using to return results on the form right now is:
$query = "SELECT * FROM directory WHERE rank IN('".implode("','", $_POST['rank'])."') AND area IN('".implode("','", $_POST['area'])."') ORDER BY last_name";
I appreciate any help. I have been reading threads and feel the solution may lie in some sort of (!isset()) coding, but I have not been able to come up with how to work the code.