I have a select html tag. I need to display the option values depends on the job title in input text. E.g. If the job title is accounting, the list of locations for accounting will be displayed in the option values.
But my code is not working. Please help me to fix this :(
<select name="locations_list" id="filterbyhiringlocation">
<option name="default" class="filter_by" selected="selected" value="Select by Location">Select by Location</option>
<?php
if(isset($_POST['jobTitle']) && $_POST['jobTitle'] == 'Sales Associate'){
foreach($query_hiring_location_mass as $option){
echo '<option name="locations_list" class="filter_by" selected value="'. $option->hiring_location .'">'. $option->hiring_location .'</option>';
} else {
echo '<option name="locations_list" class="filter_by" value="'. $option->hiring_location.'">'. $option->hiring_location .'</option>';
}
} else if(isset($_POST['jobTitle']) && $_POST['jobTitle'] == 'District Manager'){
foreach($query_hiring_location_non_mass as $option){
echo '<option name="locations_list" class="filter_by" selected value="'. $option->hiring_location .'">'. $option->hiring_location .'</option>';
} else {
echo '<option name="locations_list" class="filter_by" value="'. $option->hiring_location.'">'. $option->hiring_location .'</option>';
}
}
?>
</select>
Error:
Parse error: syntax error, unexpected 'else' (T_ELSE)
Aucun commentaire:
Enregistrer un commentaire