PHP TOTAL
Nana
-
Jeylo Messages postés 185 Date d'inscription Statut Membre Dernière intervention -
Jeylo Messages postés 185 Date d'inscription Statut Membre Dernière intervention -
Rebonsoir =D: voila mon code php panier:
<?php
session_start();
//panier.php
if ($_GET['action']=="destroy"){
session_unset();
session_destroy();
}
$ref = $_POST['choix'];
$qte = $_POST['qte'];
$_SESSION['achats'][] = array('ref' => $_POST['choix'],'qte' => $_POST['qte']);
echo "<br>";
$i = 0;
echo "<table border=1 cellspacing=0 cellpadding=0 bordercolor=black>";
echo "<tr>";
echo "<td>Produit</td>";
echo "<td>Description</td>";
echo "<td>Code Article </td>";
echo "<td>Dispo.</td>";
echo "<td>Prix unitaire</td>";
echo "<td>Qté</td>";
echo "</tr>";
do{
echo "<tr>";
echo "<td>".$_SESSION['achats'][$i]['ref']."</td>";
echo "<td>".$_SESSION['achats'][$i]['qte']."</td>";
echo "</tr>";
$i++;
}while (isset($_SESSION['achats'][$i]));
echo "</table>";
echo "<a href=panier.php?action=destroy>Détruire les sessions</a>";
echo "<br><a href=formulaire.htm>Retour</a>"
?>
Je voudrais que celui ci calcul le montant total des frais.
Merci;
<?php
session_start();
//panier.php
if ($_GET['action']=="destroy"){
session_unset();
session_destroy();
}
$ref = $_POST['choix'];
$qte = $_POST['qte'];
$_SESSION['achats'][] = array('ref' => $_POST['choix'],'qte' => $_POST['qte']);
echo "<br>";
$i = 0;
echo "<table border=1 cellspacing=0 cellpadding=0 bordercolor=black>";
echo "<tr>";
echo "<td>Produit</td>";
echo "<td>Description</td>";
echo "<td>Code Article </td>";
echo "<td>Dispo.</td>";
echo "<td>Prix unitaire</td>";
echo "<td>Qté</td>";
echo "</tr>";
do{
echo "<tr>";
echo "<td>".$_SESSION['achats'][$i]['ref']."</td>";
echo "<td>".$_SESSION['achats'][$i]['qte']."</td>";
echo "</tr>";
$i++;
}while (isset($_SESSION['achats'][$i]));
echo "</table>";
echo "<a href=panier.php?action=destroy>Détruire les sessions</a>";
echo "<br><a href=formulaire.htm>Retour</a>"
?>
Je voudrais que celui ci calcul le montant total des frais.
Merci;
A voir également:
- PHP TOTAL
- Total uninstall - Télécharger - Divers Utilitaires
- Formule total excel - Guide
- Total video converter - Télécharger - Conversion & Codecs
- Easy php - Télécharger - Divers Web & Internet
- Total adblock avis - Forum Consommation & Internet
3 réponses
Euh ca marche pas ton truc Jeylo , ref doit être la référence du produit .Tu as une case prix unitaire , si elle est bien rempli , il te suffit de faire : quantité * prix unitaire ($soustotal = $qte * $pu;) et ensuite pour le total , tu additionne chaque sous total ($total = $total + $soustotal). Tu affiche sous total a chaque ligne et total a la fin.