CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

pannier php probleme

bougarastaman
bougarastaman
Niveau 7
03 mai 2006 à 14:01:53

salut, j´ai un probleme avec le panier de mon site.
Le panier m´affiche un nombre´ de ligne correspondant au numero du produit+1. par exemple, si je commande le produit n°1 je peut le commander 2 fois.
voici mon code:
<center>

<?

$o=array();
$o[´id´]=$_GET[´noprod´];
$o[´lib´]=$_GET[´liprod´];
$o[´ptc´]=$_GET[´pu´];

if (isset($_SESSION[´achats´][$o[´id´]]))
{
echo ´toto´;
}
else
{
if(isset($o[´id´]))
$o[´qte´]=1;
if(empty($_SESSION[´achats´])){
$_SESSION[´achats´]=array();
}
array_push($_SESSION[´achats´], $o);
unset($o[´id´]);
}

echo "<H2>Votre panier</H2><TABLE bgcolor=yellow BORDER=\"1\"><TR><TH>Numéro Produit</TH><TH>Nom Produit</TH><TH>Prix produit</TH><TH>Quantité</TH></TR>";
foreach ($_SESSION[´achats´] as $o)
echo "<TR><TD> $o[id]</TD><td> $o[lib] </td><td> $o[ptc] </td><td> <input type=´integer´ name=´qte´ size=´3´ value= $o[qte] ></td><td>retirer</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>´;
?>
</center>

La boucle SI sert (normalement ) a m´affiche toto si le produit a deja ete commande.

electron_libre
electron_libre
Niveau 10
03 mai 2006 à 14:32:35

un petit session_start() au debut de ton script stp :)

bougarastaman
bougarastaman
Niveau 7
03 mai 2006 à 14:37:50

j´ai ai un.
le truc c que je voudrais qu´il m´affiche toto si le produit est deja ds le panier

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