Bonjour,
Je suis entrain de faire une liste déroulante liée
Mais j'ai encore un problème dans un code.

Dans la première liste, on choisit la stucture pour afficher la sous structure dans la deuxiéme liste avec Onchange.
Si il n'y a pas sous structure donc n'affiche pas la deuxieme liste
sans OnChange dans la première liste pour ne pas afficher directemnet
la valeur de structure sans cliquer ok

voilà le code formulaire:
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
<?php
  $chemin=$_SERVER["PHP_SELF"];
  $_nom_=@$_POST["_nom_"];
  $_prenom_=@$_POST["_prenom_"];
  $_struct_=@$_POST["_struct_"];
  $_sstruct_=@$_POST["_sstruct_"];
  $_std_=@$_POST["_std_"];
  $_dir_=@$_POST["_dir_"]; 
  $OK=@$_POST["ok"];
?>
<form action="<?php echo $chemin; ?>" method="POST" id="search">
		<table border="0" cellpadding="0" cellspacing="0" valign="top">
		<tr>
		<td id="murr_s">&nbsp;</td>
		<td id="form_s">
		<fieldset>
		<legend><b>Non</b></legend>
		<input type="text" name="_prenom_" >
		</fieldset>
		</td>
		<td id="form_s">
		<fieldset>
		<legend><b>Prenom/b></legend>
		<input type="text" name="_nom_">
		</fieldset>
		</td>
		<td id="murl_s">&nbsp;</td>
		</tr>
 
		<tr>
		<td id="murr_s">&nbsp;</td>
		<td id="form_s" colspan="2">
		<fieldset>
		<legend><b>structure</b></legend>
		<select name="_struct_" onChange="document.forms['search'].submit();">
		<option value="0">----</option>
		<?php
		for($y=0; $y<=sizeof($codec)-1; $y++) {
			echo '<option value="'.$codec[$y].'"';
			echo((isset($_struct_) && count($scodec) != 0 && $_struct_ == $codec[$y])?" selected=\"selected\"":null);
			echo '>'.$libc[$y].'</option>';
		}
		?>
	    </select>
		</fieldset>
		</td>
		<td id="murl_s">&nbsp;</td>
		</tr>
		<?php
		if(count($scodec) !=0) {
		?>
		<tr>
		<td id="murr_s">&nbsp;</td>
		<td id="form_s" colspan="2">
		<fieldset>
		<legend><b>Sous Structure</b></legend>
		<select name="_sstruct_">
		<option value="0">-- --</option>
		<?php
		for($y=0; $y<=sizeof($scodec)-1; $y++) {
			echo '<option value="'.$scodec[$y].'"';
			/*if( (count($scodec) !=0) && ($_struct_ == $codec[$y])) {
				echo 'selected';
			}*/
			//if($_struct_ == $codec[$y]) echo 'selected';
			echo '>'.$slibc[$y].'</option>';
		}
		?>
	    </select>
		</fieldset>
		</td>
		<td id="murl_s">&nbsp;</td>
		</tr>
		<?php
		}
		?>		
		<tr>
		<td id="murr_s">&nbsp;</td>
		<td id="form_s">
		<fieldset><legend><b>Standard</b></legend>
		<input type="text" name="_std_" ></fieldset>
		</td>
		<td id="form_s">
		<fieldset><legend><b>Direct</b></legend>
		<input type="text" name="_dir_" ></fieldset>
		</td>
		<td id="murl_s">&nbsp;</td>
		</tr>
		</table>
	</form>
voilà le code l'affichage
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<?php
if( count($scodec) == 0) {
echo $_nom_." ".$_prenom_." ".$_struct_." ".$_dir_." ".$_std_;
} 
if( count($scodec) != 0) {
if($OK) {
echo $_nom_." ".$_prenom_." ".$_struct_." ".$_sstruct_." ".$_dir_." ".$_std_;
}
} 
?>
Pouvez-vous m'aider?
Merci