Hi Im working on using 2 drop down menu to filter mysql query. Here is the drop down menu
<form action="showJobs.php" method="post">
<select name="Locations">
<option value="All" selected="selected">All states</option>
<option value="arizona">Arizona</option>
<option value="alaska">Alaska</option>
</select>
<select name="Jobs">
<option value="All" selected="selected">All jobs</option>
<option value="arizona">Carpenters</option>
<option value="alaska">Plumbers</option>
</select>
<input type="submit" value="search jobs" />
</form>
i can use this query
<?php
$dState = $_POST["Locations"];
$dJob = $_POST["Jobs"];
$sqlQuery = "SELECT * FROM mytable WHERE state=\"$dState\" AND job=\"$dJob\"";
?>
However, instead of requiring both a 'location' and a 'job,' the user has the option of selecting just one or the other, so that if the user selects "Arizona" and leaves the 'jobs' menu as is (for example, at the default option of 'All jobs'), we would be returned all of the carpenters, plumbers, and auto mechanics in Arizona. Or if the state was left at the default, and 'carpenters' was selected, then all the carpenters in Arizona, Alaska, and Alabama would be returned.
What would be a good way to code this?
maybe something like if conditions
if($Locations !== 'all'){
if($Jobs !== 'all'){
please help