Hello all,
I currently have a large table in MySQL with several fields. I am currently attempting to allow the user to filter by each field, via Select Boxes.
I have 4 fields: School, Division and State.
I have no problem, using PHP, on how to filter based on which option the user selects in the select box.
For example, if these 3 are submitted:
<select id="school">
<option value="13">John Brown School</option>
</select>
<select id="division">
<option value="I">I</option>
</select>
<select id="state">
<option value="NY">New York</option>
</select>
I would be able to query based on each option, like:
$school= $_POST['school'];
$division= $_POST['division'];
$state = $_POST['state'];
Query: SELECT * from table WHERE school=$school AND division=$division and state=$state
However, if I want to have an "All" option (in the select box), how would I implement this into the query or the WHERE clause, so that it does not filter that particular field?