bonjour!
petit problème lors de la suppression d'article dans mon panier
on m'a aidé mais ça ne marce pas... et je ne comprends pas vraiment pourquoi...

voici les codes :

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
 
<?
 
include ("definitioninfo.php");
include ("aff_panier.inc.php");
 
if (!session_id())
 session_start();
 
 
 
if (!isset($_SESSION['panier']))    //$panier pas defini              //sert pour la gestion du panier
{                                                           //ne pas tenir compte pr le moment
 $panier = array (
  "ref_produit" => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23),
  "quantite"  => array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 );
 $_SESSION['panier'] = $panier;
 $_SESSION['total'] = 0;
  }
 
session_register('article');
session_register('prix');
session_register('quantite');
session_register('ref_produit');
//$_POST['quantite']= $_SESSION['quantite'];
 // $_POST['article'] = $_SESSION['article'];
 
for ($i = 0; $i < 23; $i++)                                          //pr le panier
{
 //echo("article : ".$_SESSION['panier']['ref_produit'][$i]);
 //echo(" quantite : ".$_SESSION['panier']['quantite'][$i]."<br>");
}
 
 
$quantite = $_POST['quantite'];
$article = $_POST['article'];
///echo "quantite post = ".$quantite;
 
 
 
 
if(!($base=mysql_connect("localhost","root","")))
{
 echo "<br><B>probleme lors de la connexion à MySql</B><br>";
 exit();
}
else
{
 mysql_select_db(BASE, $base);
 if (($tab_com = mysql_query("SELECT ref_produit, designation_produit, prix_produit
               	 	      FROM produit
        		      WHERE designation_produit = '".$article."'", $base)))
$res_com = mysql_fetch_array($tab_com);   //tableau contenant les valeurs de la requete (resultat_commande)
}
 
$_SESSION['article'] = $res_com[1];
$_SESSION['prix'] = $res_com[2];
$_SESSION['quantite'] = $quantite;
$_SESSION['ref_produit']= $res_com[0];
 
//$_SESSION['panier']['quantite'][$_SESSION['ref_produit']]++;            //pr le panier
$_SESSION['panier']['quantite'][$_SESSION['ref_produit']] = $_SESSION['panier']['quantite'][$_SESSION['ref_produit']]+$quantite;
 
$_SESSION['total'] = $_SESSION['total']+($res_com[2]*$quantite);
//$_SESSION['TTC'] = $_SESSION['total']+ $_SESSION['total']*(19.6/100); // à aligner a droite
 
 
 
 
echo "<html>
<head>
<title>Bienvenue sur materiel-informatique.fr</title></head>
<body bgcolor=#99ff99  align=right>
<h1 align=\"center\"><font size=+6><font color=\"#000000\"><u>Votre Panier de Commande :</u></font></font></h1>
<br>
<p><form method = \"POST\" action=\"http://127.0.0.1/oceanecoin/SITE%20INFO/ordinateur%20de%20bureau.php\"><input type='submit' value='<<<<<< poursuivre mes achats'></form></p>
<table border=\"1\">
<align=\"center\">

 <tr>

 <td><b><center>Reference </b></td><br>
  <td><b><center>Article</b></td><br>
  <td><b><center>Prix Unitaire(en €)</b></td>
  <td><b><center>Quantité</b></td>
  <td><b><center>Montant</b></td>





  <td><b><center><img src ='http://127.0.0.1/oceanecoin/SITE%20INFO/corbeille.gif'>

       </td>
       </tr>";
 
 //<a href='supprime.php'=$_SESSION['panier']['ref_produit'][$i]>'supprimer'</a>
 
aff_panier(); //fonction de gestion du panier
 
 
 echo "<tr><td></td><td></td><td><b><center>Total  : </b></td><td align = \"center\"><b>".$_SESSION['total']."€</b></td></tr>";
 //echo "<tr><td></td><td></td><td><b><center>TVA : </b></td><td align = \"right\"><b>".$_SESSION['total']*(19.6/100)."€</b></td></tr>";
 //echo "<tr><td></td><td></td><td><b><h3><center>TOTAL TTC : </b></td><td align = \"right\"><h3><u><b>".$_SESSION['TTC']."€</b></td></tr>";    //sert pour le panier
 //echo "<tr><td></td><td></td><td><b><u>TOTAL :</u></b></td><td align = \"right\"><b>".$res_com[2]*$quantite." €</b></td></tr>
 echo "<tr><td></td><td></td><td></td><td colspan='1'><form method = \"POST\" action=\"http://127.0.0.1/oceanecoin/boutiqueinfo/commande2info.php\"><input type='submit' value='Terminer votre Commande'></td></tr>

 </table>
</form>
</body>
</html>"
?>
puis voici le code des fonctions de mon panier :
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
<? //sert pour le panier
//contient des fonctions utiles
if (!session_id())
session_start();
 
function aff_panier()
{
for ($i = 1; $i <= 23 ; $i++)
{
//echo("article : ".$_SESSION['panier']['ref_produit'][$i]);
//echo(" quantite : ".$_SESSION['panier']['quantite'][$i]."<br>");
//echo('<a href="http://xx/yy/supprime.php='.$_SESSION['panier']['ref_produit'][$i]);
//echo ('">Supprimer</a>');
}
 
 
if(!($base=mysql_connect("localhost","root","")))
{
echo "<br><B>probleme lors de la connexion à MySql</B><br>";
exit();
}
else
{
mysql_select_db(BASE, $base);
for ($i = 1; $i <= 23 ; $i++)
{
if (($tab_com = mysql_query("SELECT ref_produit, designation_produit, prix_produit
          FROM produit
         WHERE ref_produit = '".$_SESSION['panier']['ref_produit'][$i]."' AND '".$_SESSION['panier']['quantite'][$i]."' > 0", $base)))
 
$res_com = mysql_fetch_array($tab_com); //tableau contenant les valeurs de la requete (resultat_commande)
//print_r ($res_com);
 
 
 
$quantite = $_SESSION['panier']['quantite'][$i];
$prix = $res_com[2]*$quantite;
 
if ($quantite > 0)
{
echo " <tr align=\"center\">
<td><b>".$res_com[0]."</b></td>
<td><b>".$res_com[1]."</b></td>
<td><b>".$res_com[2]."</b></td>
<td><b>".$quantite."</b></td>
<td><b>".$prix." €</b></td>
<td><form>
<select name=liste>
  <option value=".$_SESSION['panier']['quantite'][$i]."</option>
  </select>
  </form>


<td><input type = 'submit' name = 'sub_form' value = 'supprimer'></td>



</tr>";
if(isset($_POST['sub_form' == 'supprimer'])) {
 
// si suppression
// on test si on y est 
echo "<br>Je suis bien dans la boucle suppression etape 1 --> isset";
 
if($_POST['sub_form']=="supprimer") {
// on test si on y est 
echo "<br>Je suis bien dans la boucle suppression etape 2 --> ==supprimer";
if ( isset($_SESSION['panier']['ref_produit'][$i]) ) {
echo "<br>je suis dans le cas ou on a bien une reference d&ns la session";
 
unset($_SESSION['panier']['ref_produit'][$i]);
}
else
{
echo "<br>il n'y a pas de référence dans la session";
}
}
else
{
echo "<br>sub_form n'est pas égal à \"supprimer\"";
}
}
else
{
echo "<br>sub_form n'a pas de valeur ou n'existe pas";
}
 
 
}
}
}
 
 
}
 
//<form method= POST action = 'supprime.php'>
 
//<input type=hidden name= retirer value= RETIRER >
//<input type= hidden name= article value= "echo $row['article']">
//</form>
//<input type=submit value=cliquez ici>
 
//onClick='alert(\"voullez vous vraiment supprimer?\")'>
?>
j'ai mis la fonction permettant de supprimer un article de mon panier dans aff_panier.inc.php

je suis assez embetée car ça fait plusieurs jours que je buche dessus et que je n'arrive à pas grand chose...

merci poour votre aide...