Remplir une liste deroulante en fonction d'une autre

gregou9 Messages postés 44 Date d'inscription jeudi 16 mars 2006 Statut Membre Dernière intervention 19 décembre 2013 - 7 mars 2007 à 12:34
320C Messages postés 93 Date d'inscription dimanche 24 avril 2011 Statut Membre Dernière intervention 15 janvier 2014 - 20 févr. 2013 à 17:26
J'aimerais savoir cmt remplir ma seconde liste deroulante (act) en fonction de la premiere (coffr). Voici mon code:

$liste_coffret="SELECT id,nom_fr from produits where type=0 and parent_id=0";
 
 $q=mysql_query($liste_coffret);
 $nom_fr=stripslashes($row["nom_fr"]);
?>
 <!-- Coffrets -->
 
 Veuillez selectionner un coffret

 <form name="form" action="<?php '.$PHP_SELF.' ?>" method="POST">
 <select name="coffr" size="1">


 <?php while ($row=mysql_fetch_array($q)){
 
 echo '<option value="'.$row["id"].'">'.$nom_fr.'</option>';


 } ?>
 </select>
 
 
 <?php
 $rappro="SELECT id from produits where nom_fr LIKE '".$_POST['select']."%'";
 $rap=mysql_query($rappro) or die ("Erreur :" .mysql_error());
 $liste_acti="SELECT * from produits where parent_id='".$rap."'";
 $q1=mysql_query($liste_acti) or die ("Erreur :" .mysql_error());
 $nom=stripslashes($row1["nom_fr"]);
 ?>


    <!-- Activités -->
 
 Veuillez choisir une/des activité(s)

 
 
 <li>Dans une liste</li>


 <select size="1" name="act">


 <?php while ($row1=mysql_fetch_array($q1)){
 
  echo '<option value="'.$row1["id"].'">'.$nom.'</option>';
 
  ?>
 
 </select>
 

7 réponses

gregou9 Messages postés 44 Date d'inscription jeudi 16 mars 2006 Statut Membre Dernière intervention 19 décembre 2013 1
7 mars 2007 à 14:39
cad du coté de ajax?
1
Rejoignez-nous