VOICI LE CODE DE MA PAGE ARTICLE :
<?php
include('connect_bdd.php');
$nom=$_GET['nom'];
$articles=$bdd->query("SELECT * FROM articles WHERE nom='$nom'");
$donnees_articles=$articles->fetch();
$articles->closeCursor();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $donnees_articles['nom']; ?></title>
<link rel="stylesheet" href="article.css" />
</head>
<body>
<img class="logo" src="logo.jpg" alt="logo" />
<img class="lameche" src="2M - filigrane.png" />
<header>
<img class="Texte-2Meches" src="Texte - 2Meches.png"/>
<img class="Texte-Bougiesencire" src="Texte - Bougies en cire.png"/>
</header>
<div class="liste">
<nav class="menu">
<ul>
<li><a href="index.html">ACCUEIL</a></li>
<li><a href="Produits.php">PRODUITS</a></li>
<li><a href="eco.html">ECO PRATIC'</a></li>
<li><a href="contact.php">CONTACT</a></li>
<li><a href="conseil.html">2M CONSEILS</a></li>
<li><a href="compte.php">MON COMPTE</a></li>
<li><a href="Panier.php">PANIER</a></li>
</ul>
</nav>
</div>
<article>
<div class="titre"><p><?php echo $donnees_articles['nom']; ?></p></div>
<div class="page">
<img src="<?php echo $donnees_articles['image']; ?>" class="montagnes"/>
<img src="<?php echo $donnees_articles['taille']; ?>" class="taille"/>
<img src="<?php echo $donnees_articles['taillem']; ?>" class="taillem"/>
<img src="<?php echo $donnees_articles['tailleg']; ?>" class="tailleg"/>
<div class="fiche">
<a class="categorie" href="produits.php">Retour à la boutique</a> | <div class="categorie_b"> Catégorie : <a href=""><?php echo $donnees_articles['categorie']; ?></a></div>
<div class="resume">
Résumé : <?php echo $donnees_articles['resume']; ?>
</div>
<span class="price">Prix : <strong><?php echo $donnees_articles['prix']; ?>€</strong></span>
<form method="post" action="panier.php?nom=<?php echo $donnees_articles['nom']; ?>">
<div class="quantitea">
Quantité : <input type="number" name="quantite" value="1" min="1" />
</div>
<div class="cate_taille">
Taille :
<SELECT name="categorie" size="1" type="number" >
<OPTION value="100">100
<OPTION value="150">150
<OPTION value="250">250
</SELECT>
</div>
<input type="image" src="ajouter.png" class="boutonp" />
</form>
<div class="rectangle">
</div>
</div>
</div>
</article>
</body>
</html>
ET CELUI DE MA PAGE PANIER :
<?php
session_start();
include('connect_bdd.php');
$id=$_SESSION['id'];
if(isset($_GET['nom']))
{
$nom=$_GET['nom'];
$compteur=0;
while($compteur<$_POST['quantite'])
{
$rec=$bdd->query("INSERT INTO panier (id_visiteur,nom) VALUES ('$id','$nom')");
$compteur=$compteur+1;
}
}
if(!empty($_POST))
{
extract($_POST);
if(isset($reduction))
{
if(($reduction=='PROMO40')&&($du>=250))
{
$reduction2=40;
}
elseif(($reduction=='PROMO20')&&($du>=150))
{
$reduction2=20;
}
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Panier</title>
<link rel="stylesheet" href="panier.css" />
</head>
<body>
<img class="logo" src="logo.jpg" alt="logo" />
<img class="lameche" src="2M - filigrane.png" />
<header>
<img class="Texte-2Meches" src="Texte - 2Meches.png"/>
<img class="Texte-Bougiesencire" src="Texte - Bougies en cire.png"/>
</header>
<div class="liste">
<nav class="menu">
<ul>
<li><a href="index.html">ACCUEIL</a></li>
<li><a href="Produits.php">PRODUITS</a></li>
<li><a href="eco.html">ECO PRATIC'</a></li>
<li><a href="contact.php">CONTACT</a></li>
<li><a href="conseil.html">2M CONSEILS</a></li>
<li><a href="compte.php">MON COMPTE</a></li>
<li><a href="Panier.php">PANIER</a></li>
</ul>
</nav>
</div>
<div class="texte-panier" style="color:white;">Votre panier :</div>
<form method="post" action="panier.php">
<div class="entete-panier"></div>
<table>
<?php
$resultat=$bdd->query("SELECT DISTINCT nom FROM panier WHERE id_visiteur='$id' ORDER BY id");
$nb_resultats=$bdd->query("SELECT COUNT(*) AS nb_resultats FROM panier WHERE id_visiteur='$id'");
$nb_resultats_fetch=$nb_resultats->fetch();
$nombre=$nb_resultats_fetch['nb_resultats'];
$compteur=1;
$total=0;
$nb=0;
if($resultat->rowCount()>0)
{
while($donnees_resultat=$resultat->fetch(PDO::FETCH_OBJ))
{
$nom=$donnees_resultat->nom;
$article=$bdd->query("SELECT * FROM articles WHERE nom='$nom'");
$donnees_article=$article->fetch();
$article->closeCursor();
if($compteur%2==0)
{
?>
<tr style="height:60px;">
<td style="width:403px;color:#333;" class="cellule-grise"><?php echo $donnees_article['nom']; ?></td>
<td style="width:103px;color:red;" class="cellule-grise">
<?php echo $_POST['categorie']; ?>
</td>
<td style="width:103px;color:red;" class="cellule-grise"><?php echo $donnees_article['prix']; ?>€</td>
<td style="width:103px;color:#333;" class="cellule-grise">
<?php
$nom=$donnees_article['nom'];
$nb_quantite=$bdd->query("SELECT COUNT(*) AS nb_quantite FROM panier WHERE nom='$nom' AND id_visiteur='$id'");
$nb_quantite_fetch=$nb_quantite->fetch();
$nombre_article=$nb_quantite_fetch['nb_quantite'];
$nb=$nb+$nombre_article;
echo $nombre_article;
?>
</td>
<td style="width:103px;color:#333;" class="cellule-grise"><a href="delete.php?nom=<?php echo $donnees_article['nom']; ?>"><img src="del.png" style="padding-top:8px;"/></a></td>
<td style="width:93px;color:#333;border-right:none;" class="cellule-grise"><?php $prixarticle=$donnees_article['prix']*$nombre_article;$total=$total+$prixarticle;echo $prixarticle; ?>€</td>
</tr>
<?php
$compteur=$compteur+1;
}
else
{
?>
<tr style="height:60px;">
<td style="width:403px;color:#333;" class="cellule-blanche"><?php echo $donnees_article['nom']; ?></td>
<td style="width:103px;color:red;" class="cellule-blanche">
<?php echo $_POST['categorie']; ?>
</td>
<td style="width:103px;color:red;" class="cellule-blanche"><?php echo $donnees_article['prix']; ?>€</td>
<td style="width:103px;color:#333;" class="cellule-blanche">
<?php
$nom=$donnees_article['nom'];
$nb_quantite=$bdd->query("SELECT COUNT(*) AS nb_quantite FROM panier WHERE nom='$nom' AND id_visiteur='$id'");
$nb_quantite_fetch=$nb_quantite->fetch();
$nombre_article=$nb_quantite_fetch['nb_quantite'];
$nb=$nb+$nombre_article;
echo $nombre_article;
?>
</td>
<td style="width:103px;color:#333;" class="cellule-blanche"><a href="delete.php?nom=<?php echo $donnees_article['nom']; ?>"><img src="del.png" style="padding-top:8px;"/></a></td>
<td style="width:93px;color:#333;border-right:none;" class="cellule-blanche"><?php $prixarticle=$donnees_article['prix']*$nombre_article;$total=$total+$prixarticle;echo $prixarticle; ?>€</td>
</tr>
<?php
$compteur=$compteur+1;
}
}
}
else
{
?>
<tr style="height:60px;">
<td style="width:930px;background:#fff;text-align:center;color:#333;font:14px Arial;font-weight:bold;border-radius:0 0 10px 10px;text-decoration:underline;">Votre panier est vide.</td>
</tr>
<?php
}
?>
</table>
<br>
<div class="texte-panier">
<strong>
<input type="text" name="reduction" placeholder="Code réduction" value="<?php if(isset($reduction2)) echo $reduction; ?>" style="font:13px Arial;color:#0093d1;font-weight:bold;"/>
<span style="color:#0093d1;"><?php if(isset($reduction2)){ ?>Vous bénéficiez de <?php echo $reduction2; ?>€ de réduction.<?php } ?></span>
<br>
<br>
<?php
if($total>=70)
{
echo'FRAIS DE PORT : GRATUIT';
}
else
{
?>
FRAIS DE PORT : <?php $frais=2.2*$nb; echo number_format($frais,2); ?>€ (Il vous manque <?php if(isset($reduction2)){$manque=70-$total+$reduction2;}else{$manque=70-$total;} echo number_format($manque,2); ?>€ pour avoir les frais de port offert)
<?php
}
?>
<br>
<br>
<span style="color:white;">Total de votre commande</span>
<br>
<span style="font-size:25px;color:white;"><?php if(isset($frais)){$du=$total+$frais;if(isset($reduction2)){$du=$du-$reduction2;} echo number_format($du,2); }else{$du=$total;if(isset($reduction2)){$du=$du-$reduction2;} echo number_format($du,2); } ?>€</span>
<br>
<br>
<a href="verif.php"><img src="valider.png" style="margin-right:25px;"/></a>
<input type="hidden" value="<?php echo $du; ?>" name="du"/>
<input type="image" src="maj.png"/>
<a href="produits.php"><img src="poursuivre.png" style="margin-left:25px;"/></a>
</strong>
</div>
</form>
</body>
</html>