"php dropdow menu ": update a second list select from first choise

hicham06
03:10:11
Hello everyone; thankyou for this forum.
I create a DB "koko" and one table "local" witch contains two colomns , nomlocal and NomBatiment, on total 500 records--> nomlocal and 10 records NomBatiment which are repeated for other local.
if someone can help me to create a menu dropdown when i select NomBatiment on the first select menu on the second can see just local.NomBatiment=local.nonlocal "second menu autoupdate from first select";

Thanks thanks.....
------------------

<SCRIPT language=JavaScript>
function reload(form){
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='local.php?cat=' + val ;
}
</script>



<?php


$db5 = mysql_connect('localhost', 'root', '');
mysql_select_db('koko',$db5);

$req2 = mysql_query("SELECT NomBatiment FROM local group by NomBatiment");


$batiment="";

while ($row = mysql_fetch_array($req2))
{

$nom=$row["NomBatiment"];
$batiment.="<OPTION VALUE=\"$nom\">".$nom.'</option>';


}
?>

<select NAME=NomBatiment onchange=\"reload(this.form)\"><option VALUE=0><?php echo $batiment?> </select>

<?php

$db3 = mysql_connect('localhost', 'root', '');

mysql_select_db('koko',$db3);

$req5 = mysql_query("SELECT nomlocal FROM local");


$local5="";

while ($row5 = mysql_fetch_array($req5))
{

$nom3=$row5["nomlocal"];

$local5.="<OPTION VALUE=\"$nom3\">".$nom3.'</option>';


}
?>

<select NAME=nomlocal><option VALUE=0><?php echo $local5?></select>


thanks.....
Please Login to post your reply or start a new topic