I have two drop down lists on a page which i wish to link in such a way that if a certain option is selected, the other one's value is set at a value and disabled...Is this possible...? The lists are populated from a MySQL database...here is the code...
<select name="Mouse" id="Mouse" style="width:360px">
<?php
$db = mysql_pconnect("$localhost", "$username", "$password") or die("Couldn't connect.");
mysql_selectdb("internet_compis", $db) or die("Couldn't use.");
$result = mysql_query("SELECT prodname from Products WHERE cat='Mouse' ORDER BY ourcost", $db);
while ($ra = mysql_fetch_array($result))
{
$name=$ra["prodname"];
echo" <option>$name</option>";
}
?>
</select>
<select name="Keyboard" id="Keyboard" style="width:360px">
<?php
$db = mysql_pconnect("localhost", "$username", "$password") or die("Couldn't connect.");
mysql_selectdb("internet_compis", $db) or die("Couldn't use.");
$result = mysql_query("SELECT prodname from Products WHERE cat='Keyboard' ORDER BY ourcost", $db);
while ($ra = mysql_fetch_array($result))
{
$name=$ra["prodname"];
echo" <option>$name</option>";
}
?>
</select>
I want the "mouse" box to default to a value, say "Mouse not needed", when the value in the "keyboard" box displays, say, "Don't buy a mouse"...
Please help...! 😃