How to display a second dropdown menu if a certain value in the first dropdown is selected?
I have two dropdown lists, the second should only be displayed when the value 'CN' of the first dropdown list is selected.
Can't figure that out, can you help me with this?
Here are the two dropdowns:
print "<select id='country' name = 'country'>
<option value='TW'>Taiwan</option>
<option value='CN'>China</option>
<option value='DE'>Germany</option>
<option va开发者_StackOverflowlue='JP'>Japan</option>
<option value='KR'>South Korea</option>
<option value='US'>USA</option>
<option>------------</option>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<option value='$row[iso]'>$row[printable_name]</option>";
}
print "</select>";
print "<select name='provinces' id='provinces'>
<option>------------</option>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<option value='$row[provincecode]'>$row[province]</option>";
}
print "</select>";
Have a look at this example: http://jsfiddle.net/whkQw/20/
Is it ok to check for China
or must it be CN
?
I think you need to use javascript ,check the selected value of first dropdown if it is CN then enabled the second dropdown (previously set it disabled)
精彩评论