Bonjour à tous,
Je tente vainement de créer une liste déroulante me permettant de choisir dans une deuxieme liste déroulante des options différentes selon le choix que j'aurais fait dans ma premiere liste.

Exemple dans ma Bdd :
Global type

Service collecte
Service support
Autres client
Autres fournisseurs

En choisissant "Service" dans ma 1 liste, je ne voudrais avoir le choix dans ma seconde qu' entre "collecte" et "support".

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$rqSql = "SELECT DISTINCT global_mat FROM tableau_recap";      
$result = mysql_query($rqSql);
// Construction de la chaîne de caractères qui fait la  liste
$ld = "<SELECT NAME='Choix' onchange='this.ajout.submit()'>";
$ld .= "<OPTION VALUE=0>Choisissez</OPTION>";
// On boucle sur la table
while ( $row = mysql_fetch_array( $result)) {
    $global_mat = $row["global_mat"];
    $ld .= "<OPTION VALUE='$global_mat'>$global_mat</OPTION>";
}
$ld .= "</SELECT>";
print $ld;
 
?>
 
</tr></table>
<table><tr>
 
<?
 
//select onchange='this.form.submit()'
$rqSql1= "SELECT type FROM tableau_recap WHERE global_mat='$Choix'";
$result1 = mysql_query($rqSql1);
$ld1 = "<SELECT NAME='Choix1' select onchange='this.ajout.submit()'>";
$ld1 .= "<OPTION VALUE=0>Choisissez</OPTION>";
// On boucle sur la table
while ( $row1 = mysql_fetch_array( $result1)) {
    $type = $row1["type"];
    $ld1 .= "<OPTION VALUE='$type'>$type</OPTION>";
}
$ld1 .= "</SELECT >";
print $ld1;
 
?>
Une idée, un conseil, je suis preneur