Bonjour,
Normalement, tu devrais avoir dans ta table produit une 'id' auto incrémentée. Il faut l'utiliser dans le nom des input pour fabriquer les noms, et ainsi récupérer un tableau de variables dans la page 'envoiereception.php'.
Ci-dessous, ton code très allégé, et qui utilise cette 'id' :
Code:
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
| <?php
//---------------------------------------------------
//---------------------------------------------------
if($total)
{
// debut du tableau
// lecture des résultats sur 2 colonnes, 1 résultat par ligne.
$ligne = '';
while($row = mysql_fetch_array($result))
{
$ligne .= '</tr>
<td>' . $row['nom_produit'] . '</td>
<td>' . $row['cdt'] . '</td>
<td>
<input type="text" name="qt_cdt[' . $row['id'] . ']" size ="5" value="' . $row['qt_cdt'] . '"
</td>
<td>
<input type="text" name="prix[' . $row['id'] . ']" size ="5" value="' . $row['prix'] . '"
</td>
<td>' . $row['u_qt_cdt'] . '</td>
<td>' . $row['prix_u_cdt'] . '</td>
<td>' . $row['categorie'] . '</td>
<td>' . $row['-1'] . '
<input type="text" name="qt_recept[' . $row['id'] . ']" size="6">
</td>
</tr>';
}
// fin du tableau.
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.Style1 {
color: #FFFF00;
background-color : #993333;
text-align : center;
}
.Style2 {
background-color : #CCCCCC;
text-align : center;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #00FF99;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #00FF99;
}
a:hover {
text-decoration: none;
color: #FFFF00;
}
a:active {
text-decoration: none;
}
</style>
</head>
<body>
<table width="100%" border="0">
<tr>
<td><div align="center"><img src="http://www.djoumusic.com/DJOUMATIERE/images/djoumatiere.jpg" width="800" height="150"></div></td>
</tr>
</table>
<div align="center">
<a href="/listeproduit1.php">Créer une autre recherche</a><br>
</div>
<p>
<form id="formulaire" name="formulaire" method="post" action="envoiereception.php">
<table bgcolor="#996523" align="center" border="0">
<tr>
<td width="127" class="Style1">NOM PRODUIT</td>
<td width="95" class="Style1">CDT DE COMMANDE</td>
<td width="95" class="Style1">UNITE DANS LE CDT</td>
<td width="115" class="Style1">PRIX</td>
<td width="115" class="Style1">CDT UNITAIRE</td>
<td width="110" class="Style1">PRIX CDT UNITAIRE UNITAIRE</td>
<td width="95" class="Style1">CATEGORIE</td>
<td width="95" class="Style1">LIVRAISON</td>
</tr>
<?php echo $ligne; ?>
</table>
<table width="100%" border="0">
<tr>
<td align="center">
<input type="submit" name="VALIDER" id="VALIDER" value="Envoyer" />
</td>
</tr>
</table>
</form>
</body>
</html> |
Il faut ajouter la connexion à la BDD, ainsi que la requête de récupération des produits.
Pour le reste, on verra demain.
@ ciao, bonsoir.