I want to filter my data by countries from a dropdown menu:
<form name="filter_form" method="POST" action="display_data.php">
Select a country:
<select name="value">
<option name="country" value="AU">Austria</option>
<option name="country" value="BE">Belgium</option>
<option name="country" value="BU">Bulgaria</option>
</select>
<input type="submit" name="btn_submit" value="Submit Filter" />
<?php
if($_POST['country'] == 'BE') {
$query = mysql_query("SELECT * FROM think WHERE Country='Belgium'");
}
elseif($_POST['country'] == 'AU') {
$query = mysql_query("SELECT * FROM think WHERE Country='Austria'");
} else {
$query = mysql_query("SELECT * FROM think");
}
?>
The code does not filter any data. If anyone can help, thanks!