| 12
 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
 
 |  
<html>
<head>
</head>
<body>
<form name="formulaire" method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
Choix de la liste<select name="sel1" onchange="submit()">
	<option value="list1">list1</option>
	<option value="list2">list2</option>
	<option value="list3">list3</option>
</select>
	<?php
	$list1 = array("item1","item2","item3");
	$list2 = array("item4","item5","item6");
	$list3 = array("item7","item8","item9");
 
	if (isset($_POST["sel1"])){
		switch ($_POST["sel1"]){
			case "list1" : 
				$list = $list1;
			break;
			case "list2" : 
				$list = $list2;
			break;
			case "list3" : 
				$list = $list3;
			break;
		}
	foreach ($list as $v){
		$values .= '<option value="'.$v.'">'.$v.'</option>';
	}
	echo <<<HTML
	Choix de l'item<select name="item">
		{$values}
	</select>
HTML;
 
}
?>
</form>
</body>
</html> | 
Partager