i have a problem, I have 3 drop down menus, and all of them are connected, i am creating a system that would automatically display the city's zipcode based on the provice and city of the user.
For example, the user chooses province A, then here's my problem, how would i make it so that when the user chooses province A, the system would display all the cities inside province A? i already have a complete database of the zipcode of my country, and after choosing the city, the zipcode will automatically be displayed in a text box that should not be editable but not disabled, disabling a text box would disregard it's content as i remember,
here is my query for the province,
$query = 'SELECT DISTINCT major_area FROM zipcodes GROUP BY major_area ORDER BY major_area asc ';
$result = mysql_query($query) or die(mysql_error());
echo "<select name='categories' required>";
echo "<option value =''>Select Province</option>";
while ($row = mysql_fetch_array($result)){
$major_area = $row['major_area'];
echo "<option value='$major_area'>$major_area</option>";
}
echo "</select>";
here is my query for the city drop down and major_area is shown with an example with entry 'ABRA'
$query = "SELECT DISTINCT city FROM zipcodes WHERE major_area='ABRA' ORDER BY city asc";
$result = mysql_query($query) or die(mysql_error());
echo "<select name='categories' required>";
echo "<option value =''>Select City</option>";
while ($row = mysql_fetch_array($result)){
$city = $row['city'];
echo "<option value='$city'>$city</option>";
}
echo "</select>";
and of course the zip code. i havent done it yet, but i know how to query it. i just need to make it automatic but i dont know how.
all help would be appreciated, thank you in advance.