E.g: On the first dropdown list, I choose the country where I am, and on the second, I want to put the region where I am. If I choose Portugal on the country, I only want Portuguese regions, not the entire regions table from mysql.
But now, I don't know how to grab the results from the first dropdown list to refresh the options of the second dropdown list right after I choose the option on the first dropdown list.
I have this so far...
Code: Select all
<?php
print "<select name='country' length='30'>";
$country="SELECT * from country";
$country2=mysql_query($country) or die("Could not select country");
while ($country3=mysql_fetch_array($country2))
{
print "<option>$country3[name]</option>";
}
print "</select><br>";
print "<select name='region' length='30'>";
$region="SELECT * from country where ownedby = '$country3'";
$region2=mysql_query($region) or die("Could not select country");
while ($region3=mysql_fetch_array($region2))
{
print "<option>$region3[name]</option>";
}
print "</select><br>";
?>