ive been stuck on this problem for a few days, and cant get it to work. k. ive got two select menus. one gets values from a database. when one from the first select is chosen, it puts a value in a variable using java script. i want the second select to depending on that variable, get values from a database. people can change the first select which means that the second select needs to change every time the first one changes. i just cant get it to work.
function getSelect() {
document.stuff.Total.value = document.stuff.Servicesss.options[document.stuff.Servicesss.selectedIndex].value;
}
1st select
<?php
mysql_connect('localhost','root');
mysql_select_db('Health');
$result = mysql_query("SELECT Service FROM services");
echo "<SELECT name=\"Servicesss\" onBlur=\"getSelect(this)\">\n";
echo "<OPTION value=\" \"> </OPTION>\n";
while($row = mysql_fetch_assoc($result)) {
echo "<OPTION value=\"{$row['Service']}\">{$row['Service']}</OPTION>\n";
}
echo "</SELECT>\n";
?>
second select
<?php
mysql_connect('localhost','root');
mysql_select_db('Health');
$result5 = mysql_query("SELECT * FROM practitioners WHERE MainAccr='$Total'");
echo "<SELECT name=\"Doctors\">\n";
echo "<OPTION value=\" \"> </OPTION>\n";
while($row = mysql_fetch_array($result5)) {
echo "<OPTION value=\"{$row['MainAccr']}\">Dr {$row['MainAccr']}</OPTION>\n";
}
echo "</SELECT>\n";
?>
any ideas or thoughts would be great