ce script est sensé me permettre de lier plusieurs couple de listes déroulantes liés le problème est que c'est seulement les premières listes qui s'affichent(regardez image)
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
<?php include("connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript">
function liste_mat_pre(f){
var 11=f.elements["mat_pre"];
var 12=f.elements["des_typ_pre"];
var index=11.selectedIndex;
	if(index<1)
	12.options.length=0;
	else{
	var xhr_object=null;
		if(window.XMLHttpRequest)
			xhr_object=new XMLHttpRequest();
			else if(window.ActiveXObject)
			{
			xhr_object= new ActiveXObject("Microsof.XMLHTTP");
			}
			else
			{
			alert("votre navigateur ne supporte pas les objects XMLHTTPxhr_objectREQUEST....");
			return;
			}
			xhr_object.open("post","typ_mat_pre.php",true);
			xhr_object.onreadystatechange=function(){
			if(xhr_Object.readyState==4)
			eval(xhr_Object.responseText);
			}
			xhr_Object.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			var data="champs="+escape(11.options[index].value)+"&form="+f.name+"&select=des_typ_pre";
			xhr_Object.send(data);
			}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
 
<body>
<form action="liste_deroulante6.php" method="post" name="form" id="form">
<table width="438">
<?php
        for($i=1;$i<10;$i++){
        ?>
<tr>
<td width="10">
<select name="mat_pre" id="mat_pre" onchange="liste_mat_pre(this.form)">
<option value="0">Choisir une matière première</option>
<?php
$req="SELECT * FROM matiere_premiere where des_mat_pre!='tissus' ORDER BY des_mat_pre";
$resreq= mysql_query($req) or die(mysql_error()); 
while($lisdr=mysql_fetch_assoc($resreq))
{
?>
<option value="<?php echo $lisdr['code_mat_pre']; ?>"><?php echo $lisdr['des_mat_pre']; ?></option>
<?php
}
 if (!$lisdr)
echo "erreur";
?>
</select>
</td>
<td width="10"><select name="des_typ_pre" id="des_typ_pre">
</select>
</td>
</tr>
<?php
}
mysql_close();
?>
</table>
</form>
</body>
</html>
et concernant la page typ_mat_pre.php je l'ai mis dans les fichiers joints!!
et voici la structure de mes tables et de mes données la première matiere_premiere
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
#
# Structure de la table `matiere_premiere`
#
 
CREATE TABLE matiere_premiere (
  code_mat_pre int(20) NOT NULL auto_increment,
  des_mat_pre varchar(20) NOT NULL default '',
  PRIMARY KEY  (code_mat_pre)
) TYPE=MyISAM;
 
#
# Contenu de la table `matiere_premiere`
#
 
INSERT INTO matiere_premiere VALUES (1, 'tissus');
INSERT INTO matiere_premiere VALUES (2, 'mousse');
INSERT INTO matiere_premiere VALUES (3, 'passementerie');
INSERT INTO matiere_premiere VALUES (4, 'mercerie');
INSERT INTO matiere_premiere VALUES (5, 'preparation');
INSERT INTO matiere_premiere VALUES (6, 'quicaillerie');
INSERT INTO matiere_premiere VALUES (7, 'accessoire');
et voici la seconde type_matiere_premiere et une partie de ses données
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
#
# Structure de la table `type_matiere_premiere`
#
 
CREATE TABLE type_matiere_premiere (
  code_typ_mat_pre int(20) NOT NULL auto_increment,
  code_mat_pre varchar(20) NOT NULL default '',
  couleur varchar(20) NOT NULL default '',
  des_typ_mat_pre varchar(20) NOT NULL default '',
  code_four varchar(20) NOT NULL default '',
  PRIMARY KEY  (code_typ_mat_pre)
) TYPE=MyISAM;
 
#
# Contenu de la table `type_matiere_premiere`
#
 
INSERT INTO type_matiere_premiere VALUES (8, '1', '', 'sémoniaque', '1');
INSERT INTO type_matiere_premiere VALUES (9, '5', 'jaunes+ rouge', 'beque', '2');
INSERT INTO type_matiere_premiere VALUES (10, '6', 'jaune', 'pince', '3');
INSERT INTO type_matiere_premiere VALUES (11, '6', 'jaune', 'pince4', '4');
INSERT INTO type_matiere_premiere VALUES (12, '6', 'jaune', 'pince fr', '5');
INSERT INTO type_matiere_premiere VALUES (13, '1', 'bleu', 'tri', '6');
INSERT INTO type_matiere_premiere VALUES (15, '1', '', 'kioool', '8');
INSERT INTO type_matiere_premiere VALUES (16, '2', '', 'mousse de 14 25S', '9');
INSERT INTO type_matiere_premiere VALUES (17, '2', 'bleu', 'mousse de 5 20/22', '10');
INSERT INTO type_matiere_premiere VALUES (18, '2', 'rouge', 'mousse de 10 25S', '11');
merci!!