explorer et session: secours !!!
Posté : 30 nov. 2005, 20:59
Bonjour à tous,
J'utilise des sessions pour faire fonctionner un panier sur un site commercial.
Et je viens de me rendre compte que tout fonctionne parfaitement sur Netscape, Safari... sauf sur IE !
Voici le code qui récupère les données en POST et les envoie dans mon tableau (1). L'autre code est celui qui récupère les données du tableau pour afficher le panier en lui-même (2).
Avec IE, je reçois le message "Votre panier est vide...". Je ne comprends pas pourquoi. Pouvez-vous m'aider.
(1)
J'utilise des sessions pour faire fonctionner un panier sur un site commercial.
Et je viens de me rendre compte que tout fonctionne parfaitement sur Netscape, Safari... sauf sur IE !
Voici le code qui récupère les données en POST et les envoie dans mon tableau (1). L'autre code est celui qui récupère les données du tableau pour afficher le panier en lui-même (2).
Avec IE, je reçois le message "Votre panier est vide...". Je ne comprends pas pourquoi. Pouvez-vous m'aider.
(1)
<?php
if (isset($_POST["Commander"])){
$refprod = $_POST["reference"];
$qt = $_POST["quantite"];
$pu = $_POST["prixunitaire"];
$pa = $_POST["prixactuel"];
require_once('deja.php');
if(!verif_panier($refprod)) {
//vérification de la validité des données du formulaire //
if(!is_numeric($qt)) {
require_once('qt_non_num.php');
exit();
} else {
array_push($_SESSION ['caddie']['produit']['quantite'],$qt);
array_push($_SESSION ['caddie']['produit']['reference'],$refprod);
array_push($_SESSION['caddie']['produit']['prixunitaire'],$pu);
array_push($_SESSION['caddie']['produit']['prixactuel'],$pa);
$total_prod = ($qt * $pa);
array_push($_SESSION['caddie']['produit']['totalproduit'],$total_prod);
$acompte_prod = (($qt * $pu) / 2);
array_push($_SESSION['caddie']['produit']['acompteproduit'],$acompte_prod);
$solde_prod = ($total_prod - $acompte_prod);
array_push($_SESSION['caddie']['produit']['soldeproduit'],$solde_prod);
}
}
}
?>
(2)
<?php
function recup_panier(){
$articles = 0;
$articles = count($_SESSION['caddie']['produit']['reference']);
if (!$articles){
echo '<td align="center" colspan="6" style="text-align: center; vertical-align: middle; height: 100px;">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<br><b>Votre Panier est vide !<br><br>
Cliquez sur le bouton " Retour " ci-dessous pour revenir à la page précédente, ou sur "Retour au catalogue".</b><br><br>
<a href = "Bordeaux.php"><span style="color: rgb(216, 0, 0); font-weight: bold;font-family: Arial;">Retour au catalogue</span></a><br>
</span>
</td>';
}
else {
for ($i = 0; $articles > $i; $i++) {
echo '<tr>
<td colspan="6">
<table style="width: 750px;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align: top; text-align: left;">
<table style="width: 750px; text-align: left;" border="0" cellpadding="0" cellspacing="2">
<form method="post" action="Panier.php">
<tr>
<td colspan="1" rowspan="1" style="width: 4px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
</td>
<td colspan="1" rowspan="1" style="width: 175px; height: 35px; vertical-align: middle; text-align: left; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(216, 0, 0); font-weight: bold;font-family: Arial;">
<div style="margin-left: 10px;">
<small>
'.$_SESSION['caddie']['produit']['reference'][$i].'
<input type="hidden" value="'.$_SESSION['caddie']['produit']['reference'][$i].'" name="reference">
</span></small></small></div>
</td>
<td colspan="1" rowspan="1" style="width: 75px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<small>
<b>'.$_SESSION['caddie']['produit']['prixunitaire'][$i].'€</b></small>
</span>
</td>
<td colspan="1" rowspan="1" style="width: 75px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<small>
<b>'.$_SESSION['caddie']['produit']['prixactuel'][$i].'€</b></small>
</span>
</td>
<td colspan="1" rowspan="1" style="width: 50px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<small>
<input value="'.$_SESSION['caddie']['produit']['quantite'][$i].'" maxlength="3" size="3" name="quantite">
</small>
</td>
<td colspan="1" rowspan="1" style="width: 75px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<small>
<b>'.$_SESSION['caddie']['produit']['totalproduit'][$i].'€</b></small>
</span>
</td>
<td colspan="1" rowspan="1" style="width: 75px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold;font-family: Arial;">
<small>
<b>'.$_SESSION['caddie']['produit']['acompteproduit'][$i].'€</b></small>
</span>
</td>
<td colspan="1" rowspan="1" style="width: 75px; height: 35px; vertical-align: middle; text-align: center; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<span style="color: rgb(255, 255, 255); font-weight: bold; font-family: Arial;">
<small>
<b>'.$_SESSION['caddie']['produit']['soldeproduit'][$i].'€</b></small>
</span>
</td>
<td colspan="1" rowspan="1" style="width: 146px; height: 35px; vertical-align: middle; text-align: right; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<input type="image" src="Modif_qt.jpg" name="Modifier" value="Modifier Qt">
</td>
</tr>
</table>
</tr>
<tr>
<td style="vertical-align: top; text-align: left;">
<table style="width: 750px; text-align: left;" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="1" rowspan="1" style="width: 550px; height: 20px; vertical-align: middle; text-align: left; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
</td>
<td colspan="1" rowspan="1" style="width: 200px; height: 20px; vertical-align: middle; text-align: right; font-family: Arial; font-weight: bold; color: rgb(255, 255, 255);">
<input type="image" src="Supprim_prod.jpg" name="RisetteProd" value="Supprimer ce produit">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>';
}
}
}
?>