Valider la commande d'un panier
Bonjour,
j'ai suivi le tutoriel de RideKick sur la création d'un panier en php.
Pour afficher un résumer de ma commande, j'utilise le code suivant:
Code:
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
| <form name="valier" method="post" action="validerpanier.php">
<table>
<tr>
<td>Nom</td><td></td><td></td><td>Quantité</td><td></td><td></td><td>Prix Unitaire</td><td></td><td></td><td>Action</td>
</tr>
<?php
for ($i=0 ;$i < $nbArticles ; $i++)
{
echo "<tr>";
echo "<td>".htmlspecialchars($_SESSION['panier']['libelleProduit'][$i])."</td><td></td><td></td>";
echo "<td><input type=\"text\" size=\"4\" name=\"q[]\" value=\"".htmlspecialchars($_SESSION['panier']['qteProduit'][$i])."\"/></td><td></td><td></td>";
echo "<td> ".htmlspecialchars($_SESSION['panier']['prixProduit'][$i])." euro</td><td></td><td></td>";
echo "<td><a href=\"".htmlspecialchars("resumpanier.php?action=suppression&l=".rawurlencode($_SESSION['panier']['libelleProduit'][$i]))."\">Supprimer</a></td>";
echo "</tr>";
}
echo "<tr><td colspan=\"2\"> </td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>";
echo "<td colspan=\"2\">";
echo "Total : ".MontantGlobal()." euro";
echo "</td></tr>";
echo "<tr><td colspan=\"4\">";
echo "<input type=\"submit\" value=\"Rafraichir\"/>";
echo "<input type=\"hidden\" name=\"action\" value=\"refresh\"/>";
?>
<br/>
<br/>
<input type="submit" name="valider" value="Valider ma commande"/>
<?php
}
?>
</table>
</form> |
Comment puis-je passer la commande en inscrivant cela dans la table commande sachant qu'elle contient:
- le nom et prénom du client (fait)
-le nom du produit: produit
-le prix du produit: prix
-la quantité du produit: qt
-le tarif: tarif
-une date: date
Mon prof d'info m'a expliquer le principe, en me mettant en garde sur la difficulté de la chose :D
Quelqu'un aurait un bout de code source sur lequel je peux prendre appui ?
Merci d'avance :D