Bonjour,

Si quelqu'un se sent de jetter un oeil à cette soupe de code dont je suis tres fier un peu sans raison puisqu'elle ne marche pas.
C'est adapte d'un tuto du site, je n'arrive pas a mettre a jour mes quantites d'article dans le panier.
J'ai ajoute un variable $toto pour tester et j'ai l'impression que le bouton rafraichir ne marche pas et je n'arrive pas a aller dans le case=refresh, ce n'est donc pas ma fonction modifierQuantite qui serait defectueuse.


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
if ($erreur==false){
 
 switch($action){
 
  Case "suppression":
 
  supprimerArticle($_GET['l']);
  break;
 
  Case "refresh" :
 
  $toto = 4;
  for ($i = 0 ; $i < count($QteArticle) ; $i++)
  {
   modifierQuantite($_SESSION['panier']['prod'][$i],round($QteArticle[$i]));
  }
 
  break;
 
  Default:
  break;
 
 }
}
 
?>
<form method="post" action="panier.php">
<table style="width: 700px">
 
<?php
 
if (creationPanier())
{
$nbArticles=count($_SESSION['panier']['prod']);
  if ($nbArticles <= 0)
   echo "<tr><td>Votre panier est vide </ td></tr>";
  else
  {
      echo "<tr><td>Article</td>";
      echo "<td>Couleur</td>";
      echo "<td>"; echo $C_1.$toto;
      echo "</td><td>Quantité</td>";
      echo "<td>Prix Unitaire</td>";
      echo "<td>Action</td></tr>";
   for ($i=0 ;$i < $nbArticles ; $i++)
   {
    echo "<tr>";
    echo "<td style='width: 370px'>".$_SESSION['panier']['produit'][$i]." ".$_SESSION['panier']['ref'][$i]."<i>".
		($_SESSION['panier']['pack'][$i]!=0 ? "<br />&nbsp;-&nbsp;Pack:&nbsp;". $_SESSION['panier']['pack'][$i] : "").
		($_SESSION['panier']['taille'][$i]!=0 ? "<br />&nbsp;-&nbsp;Taille:&nbsp;". $_SESSION['panier']['taille'][$i] : "").
		($_SESSION['panier']['choix'][$i]!=0 ? "<br />&nbsp;-&nbsp;Choix:&nbsp;". $_SESSION['panier']['choix'][$i] : "").
		($_SESSION['panier']['c_prix'][$i]!=0 ? "<br />&nbsp;-&nbsp;".$C_PRIX.":&nbsp;". $_SESSION['panier']['c_prix'][$i] : "").
		"</i></ td>";
    echo "<td style='width: 90px'>";  
        $couleurs = array();
	getCouleurs($couleurs,$CATALOGUE);
	echo "<select name=\"Couleur[]\" id='couleur[]' style='width: 80px'>\n";
	foreach($couleurs as $couleur)
		echo "<option value='".$couleur->getCouleurId()."' ".
		(($couleur->getCouleurId()==$_SESSION['panier']['couleur_id'][$i]) ? 'SELECTED' : '').
		">". $couleur->getCouleur() . "</option>\n";
	echo "</select>\n";
    echo "</td>";
     echo "<td style='width: 90px'>";
        $c_1s = array();
	getC_1s($c_1s,$CATALOGUE);
	echo "<select name=\"C_1[]\" id='c_1[]' style='width: 80px'>\n";
	foreach($c_1s as $c_1)
		echo "<option value='".$c_1->getC_1Id()."' ".
		(($c_1->getC_1Id()==$_SESSION['panier']['c_1_id'][$i]) ? 'SELECTED' : '').
		">". $c_1->getC_1() . "</option>\n";
	echo "</select>\n";
    echo "</td>";
    echo "<td style='width: 70px'><input type=\"text\" size=\"4\" name=\"QteArticle[]\" value=\"".$_SESSION['panier']['quantite'][$i].
    "\" onkeypress=\"chiffres(event)\"/></td>";
    echo "<td style='width: 60px'>".$_SESSION['panier']['prix'][$i]."</td>";
    echo "<td style='width: 20px'><a href=\"".htmlspecialchars("panier.php?action=suppression&l=".rawurlencode($_SESSION['panier']['prod'][$i]))."\">&nbsp;&nbsp;<input type='image' src='/gif/poubelle.gif'/></a></td>";
    echo "</tr>";
   }
 
  echo "<tr><td colspan=\"4\"> </td>";
  echo "<td colspan=\"2\">";
  echo "<b>Total : " .MontantGlobal();
  echo "</b></td></tr>";
 
  echo "<td></td>";
  echo "<tr><td colspan=\"3\">";
  echo "<input type=\"submit\" value=\"Rafraichir\"/>";
  echo "<input type=\"hidden\" name=\"action\" value=\"refresh\"/>";
  echo "</td>";
  echo "<td>";
  echo "<td colspan=\"2\"><input type=\"submit\" value=\"Finaliser la commande\"/>";
  echo "<input type=\"hidden\" name=\"action\" value=\"payer\"/>";
  echo "</td></tr>";
  }
}