Affichage de caddie
Posté : 18 mai 2010, 13:10
Bonjour a tous. Je débute en PHP et je n'ai pu avoir une réponse coté forum PHP débutant.
Voila je développe un projet d'étude qui consiste a un site e-commerce. (site de vente de matériel informatique)
Quand j'affiche mon caddie j'obtiens la même ligne qui se répète 7 fois !!
Puis quand je sélectionne un autre produit ca m'écrase le produit précédent !
Est ce que quelqu'un peut m'aider svp
Voila le code : Ajout caddie.php
Voila je développe un projet d'étude qui consiste a un site e-commerce. (site de vente de matériel informatique)
Quand j'affiche mon caddie j'obtiens la même ligne qui se répète 7 fois !!
Puis quand je sélectionne un autre produit ca m'écrase le produit précédent !
Est ce que quelqu'un peut m'aider svp
Voila le code : Ajout caddie.php
<?php
session_start();
require ('bordure_haut.inc');
$_SESSION['caddie']=array('id'=>'','Photo'=>'','Libelle'=>'','Marque'=>'','Caracterestique'=>'','quantite'=>1, 'Prix_vente'=>'' );
require ('haut_de_page.php');
print "<table border='1' bgcolor='aliceblue' cellspacing='3'><caption><tr>";
print "</table>";
print "<font color ='blue' align ='center'><h1>Votre caddie</h1></font>";
print "<body bgcolor='aliceblue'>";
print "</table></br></br></br>";
print "<table border='1' bgcolor='#87CEFA' bordercolor='0' cellspacing='3' align='center'><caption><tr>";
print "<th width='10%'>id</th><th width='10%'>Photo</th><th width='25%'>Libellé</th><th width='50%'>Caracterestisues</th><th
width='10%'>Quantité</th></td>";
print "<th width='20%'>Prix (TTC)</th><th width='5%'>Supprimer</th></tr>";
$color1='#00BFFF';
$color2='#87CEFA';
if (!empty ($SESSION['qte']))
$_SESSION[qte]=1;
reset($_SESSION['caddie']);
while(list($id, $contenu)= each($_SESSION['caddie']))
{
//on affiche le résultat
print '<tr>';
print "<td width='10%' bgcolor='$color1' align='center'><h4>$_SESSION[id]</h4></th>";
print "<td width='10%' bgcolor='$color1' align='center'><ahref='$_SESSION[Photo]' target=''><img src='$_SESSION[Photo]'
border='0' height='40' width='40' alt='Agrandir'></a></th>";
print "<td width='30%' bgcolor='$color1' align='center'><h4>$_SESSION[Libelle]</h4></th>";
print "<td width='50%' bgcolor='$color1' align='center'><h4>$_SESSION[Caracterestique]</h4></th>";
print "<td width='10%' bgcolor='$color1' align='center'><h4><table border=0 >";
print "<td rowspan=2><input type='text' name='Nom' value=$_SESSION[qte]></td>";
print "<td><a href='addition.php?qte=$_SESSION[qte]'><img border=0
src='C:\Program Files\EasyPHP\www\Projet\IMAGES\quantite_plus.bmp'></td></a></tr>";
print "<tr><td><a href='soustraction.php?qte=$_SESSION[qte]'><img border=0 src='C:\Program
Files\EasyPHP\www\Projet\IMAGES\quantite_moin.bmp'></a></td></tr>";
print "</table>";
print "</h4></th>";
print "<td width='20%' bgcolor='$color1' align='center'><h4>".$_SESSION['Prix_vente'] * $_SESSION['qte']." €</h4></th>";
print "<td width='10%' bgcolor='$color1' align='center'><a href=''><img src='images/delete.gif' border='0' height='20' width='20'
alt='supprimer'></a></th>";
print "</tr>";
$color3=$color2 ;
$color2=$color1 ;
$color1=$color3 ;
}
print '</table></br>';
//$total=$total+$Prix_vente;
print "<table border='0' bgcolor='#B0C4DE' bordercolor='0' cellspacing='3' align='right'><caption><tr>";
print '</table></br>';
print "<center><table border='0' color='aliceblue' cellspacing='3'><caption><tr>";
echo '<tr><td><center><ahref="acheter_caddie.php?montant=$total"><img src="image/bouton_page_achat1.gif"
border="0"/></a></center></td>'.'<td><center><a href="vider_caddie.php"><img
src="image/bouton_page_vider.gif" border="0"/></a></center></td><td><center><a
href="acceuil.php"><img src="image/retour.gif"
border="0"/></a></center></td></tr>';
print '</table></center>';
require ('bordure_bas.inc');
?>