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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
| <?php session_start();
include("dynamique/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>
//fonction listes déroulantes lié 1
<script language="JavaScript">
function liste_mat_pre(f,i)
{
liste1 ="mat_pre"+i;
liste2 ="des_typ_pre"+i;
var l1=f.elements[liste1];
var l2=f.elements[liste2];
var index = l1.selectedIndex;
if(index<1)
l2.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="champ="+escape(l1.options[index].value)+"&form="+f.name+"&select="+escape(liste2);
xhr_object.send(data);
}
}
//fonction liste déroulante liés 2 même concept que la première
function liste_col_pre(c,j)
{
list1 ="des_typ_pre"+j;
list2 ="couleur"+j;
var m1=c.elements[list1];
var m2=c.elements[list2];
var index = m1.selectedIndex;
if(index<1)
m2.options.length=0;
else
{
var xhr = null;
if(window.XMLHttpRequest) xhr=new XMLHttpRequest();
else if(window.ActiveXObject)
{
xhr= new ActiveXObject("Microsof.XMLHTTP");
}
else
{
alert("votre navigateur ne supporte pas les objects XMLHTTPxhr_objectREQUEST....");
return;
}
xhr.open("POST", "couleur_mat_pre.php", true);
xhr.onreadystatechange=function(){
if(xhr.readyState==4)
eval(xhr.responseText);
}
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
var data="champ="+escape(m1.options[index].value)+"&form="+c.name+"&select="+escape(list2);
xhr.send(data);
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>insertion quantité de matières premières utilisés</title>
<style type="text/css">
<!--
.Style1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#00FFFF" text="#000000" vlink="#FF00FF" alink="#FFFFFF">
//les listes déroulantes en cases de tableau aucun problème elles sont fonctionnels
<form action="dynamique/dynamique-formu4.php" method="post" name="form" id="form">
<span class="Style1">Table matières premières</span>
<table width="550">
<tr>
<td width="192"><div align="center">Matière première </div></td>
<td width="192"><div align="center">DéSIGNATION</div></td>
<td width="144"><div align="center">couleur</div></td>
<td width="144"><div align="center">QTE</div></td>
</tr>
<tr>
<td width="201"><select name="mat_pre1" id="mat_pre1" onchange="liste_mat_pre(this.form,1);">
<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
}
?>
</select></td>
<td width="91"><select name="des_typ_pre1" id="des_typ_pre1" onchange="liste_col_pre(this.form,1)">
<option value="0">-type matière-</option>
</select></td>
<td width="127"><select name="couleur1" id="couleur1" >
<option value="0">- sa couleur-</option>
</select></td>
<td width="111"><input type="text" name="qte-mat-pre1" id="qte-mat-pre1" /></td>
</tr>
<tr>
<td width="201"><select name="mat_pre2" id="mat_pre2" onchange="liste_mat_pre(this.form,2);">
<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
}
?>
</select></td>
<td width="91"><select name="des_typ_pre2" id="des_typ_pre2" onchange="liste_col_pre(this.form,2)"><option value="0">-type matière-</option>
</select></td>
<td width="127"><select name="couleur2" id="couleur2" ><option value="0">- sa couleur-</option>
</select></td>
<td width="111"><input type="text" name="qte-mat-pre2" id="qte-mat-pre2" /></td>
</tr>
<tr>
<td width="201"><select name="mat_pre3" id="mat_pre3" onchange="liste_mat_pre(this.form,3);">
<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
}
?>
</select></td>
<td width="91"><select name="des_typ_pre3" id="des_typ_pre3" onchange="liste_col_pre(this.form,3)"><option value="0">-type matière-</option>
</select></td>
<td width="127"><select name="couleur3" id="couleur3" ><option value="0">- sa couleur-</option>
</select></td>
<td width="111"><input type="text" name="qte-mat-pre3" id="qte-mat-pre3" /></td>
</tr>
... |
Partager