Mettre à jour un champ SELECT en fonction d'un autre champ SELECT
coeur_de_motard
Messages postés3Date d'inscriptiondimanche 26 février 2006StatutMembreDernière intervention23 août 2007
-
13 mars 2006 à 18:46
coeur_de_motard
Messages postés3Date d'inscriptiondimanche 26 février 2006StatutMembreDernière intervention23 août 2007
-
15 mars 2006 à 07:55
J'ai une base de données avec un table pour les services d'une entreprise et une table avec les personnels des différents services
J'ai un champ SELECT qui contient la liste des services. Quand je sélectionne un service, je veux que mon deuxième champ SELECT n'affiche que la liste des peersonnels de CE service. voici mon code :
<tr align="left" valign="middle" style="height:25px">
<td colspan="2"></td>
<td align="right" style="background-color:rgb(255, 255, 230)" colspan="2">Sélectionnez le service concerné :</td>
<td style="background-color:rgb(255, 255, 230)">
<SELECT NAME="s_service" onchange="document.location.href=Modifier.php">
<?
$sql="SELECT * FROM services ORDER BY service";
$result = mysql_query($sql);
while($data = mysql_fetch_assoc($result))
{
echo '<option>'.$data['service'].'</option>';
} ?>
</SELECT></td>
<td colspan="2"></td>
</tr>
<tr align="left" valign="middle" style="height:25px">
<td></td>
<td align="right" style="background-color:rgb(255, 255, 230)" colspan="2">Sélectionnez le personnel concerné :</td>
<td style="background-color:rgb(255, 255, 230)" colspan="3">
<SELECT NAME="s_personnel">
<?
$sql="SELECT * FROM personnels WHERE affectation='$_SESSION[membre]' AND actif='OUI' ORDER BY nom";
$result = mysql_query($sql);
while($data = mysql_fetch_assoc($result))
{
echo '<option>'.$data['nom'].'</option>';
} ?>
</SELECT></td>
<td></td>
</tr>
Comment faire ? en PHP ? en JAVASCRIPT ?
Merci d'avance !