ce que je veus c'est d'afficher deux liste dependantes,selon le choix de la premiere s'affiche la deuxieme,celui ci c'est mon code et j'espere que tu le repare bout de code: <html><head><title></title></head><body><form name="maforme" action="" method="POST"> <?php $co=mysql_connect("localhost","root",""); $dbnom="test"; $db=mysql_select_db($dbnom,$co); $res=mysql_query("SELECT * FROM tabl1",$co); $max=@mysql_num_rows($res); ?> <script type="text/javascript"> function appel() { location.href= "test.php?tbl2="+tb1.options[tb1.selectedIndex].text; } </script> <select name="tb1" size=1 onChange="appel();"> <?php for ($nb=0;$nb<$max;$nb++) { $i=mysql_result($res,$nb,"t1ind"); ?> <option><?php echo $i; } ?> </select> </body> </form> <?php if (isset($_POST["tbl2"])) { //======================================= //== si tbl2 est défini, c'est qu'on a == //== cliqué sur une ligne de table 1 == //======================================= $rch="WHERE t2t1ind='".$_POST["tbl2"]."' "; $res=mysql_query("SELECT * FROM tabl2 ".$rch,$co); $max=@mysql_num_rows($res); //=============================================== //== on affiche donc dans un select la TABLE 2 == //=============================================== ?> <select name="tb2" size=1> <?php for ($nb=0;$nb<$max;$nb++) { $i=mysql_result($res,$nb,"t2ind"); ?> <option><?php echo $i; } ?> </select><?php } ?> je vous remercie pour votre aide d'avance j'atend
|