bonjour,
mon problème est le suivant:
je n'arrive pas à faire le calcul de la somme global de mon devis
ça me calcul que la somme d'une ligne
voici mon bout de code
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
echo '<form method="POST" action="f2.php>"<center><table id="devis">
<tr><th> Ref </th><th width=200> Dénomination </th><th width=100> Prix unitaire </th><th width=100> Quantitée </th><th width=100> Prix </th></tr>';
if(isset($_POST['idProduit']))
{
    foreach ($_POST['idProduit'] as $clef=>$idProduit)
{
  // REQUÊTE SQL de récupération des informations du produit<br>
  $sql = "SELECT * FROM produit WHERE id_produit = '$idProduit'";
  $req = mysql_query($sql) or die (mysql_error());
  $recup = mysql_fetch_assoc($req);
  // affichage d'une ligne
$quantite=$_POST['quantite'][$clef];
echo'<tr><td>'.$idProduit.'</td><td>'.$recup['nom_produit'].'</td><td>'.$recup['prix_produit'].'</td>';
echo'<td>'.$quantite.'</td>';
echo '<td>';
$prix = $recup['prix_produit'];
$t = $prix * $quantite;
echo $t;
echo '</td></tr>';
}
}
// début de mon souci mon problème
echo'<tr><td colspan=3></td><td><b>TOTAL:</b></td><td>';
$total = 0;
$total += $t;
echo $total;
echo'</td></tr></table></center>';
pouvez vous m'éclairer?