Newsletter
Liste des sujets

pannier php

bougarastaman
bougarastaman
Niveau 7
08 mars 2006 à 15:14:41

salut
voila mon probleme:
j´ai un pannier sur mon site cependant lorsque j´ajoute un nouveau produit toutes la colonne du libelle et de du prix changent et prennent comme valeur le libelle et le prix du dernier produits.
voila mon code:
<?
if (! isset($_SESSION[´panier´]) )
{
$_SESSION[´panier´] = array();
}
$produit = $_GET[´noprod´];
$lib = $_GET[´liprod´];
$pu=$_GET[´pu´];
if (isset($_SESSION[´panier´][ $produit ]) ){
$_SESSION[´panier´][ $produit ] += 1;

}
else
{
$_SESSION[´panier´][ $produit ] = 1;
}
if (isset( $_SESSION[´panier´] ) )
{
echo "<H2>Votre panier</H2><TABLE
BORDER=\"1\"><TR><TH>Produit</TH><th>Libelle</th><
TH>Quantité</TH><th>Prix unitaire</th></TR>";
foreach ($_SESSION[´panier´] as $produit => $quantite)

echo "<TR><TD> $produit </TD><td> $lib </td><TD> $quantite </TD><td>$pu</td></TR>";
}
echo ´</TABLE><a href="index.php?env=1" style="color:red">valider votre commande</a><br>´;
echo ´<a href="index.php?eff=1" style="color:red">effacer le pannier</a><br>´;
echo ´<a href="index.php" style="color:red">retour</a>´;
?>

saintange
saintange
Niveau 10
08 mars 2006 à 15:39:54

ca doit venir de ton get. l´érreur ne doit pas etre dans ce code.

Sous forums
  • Aide à l'achat Mac
  • Macintosh
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Internet
  • Steam Deck
  • Hardware
La vidéo du moment