Created
October 24, 2010 04:23
-
-
Save guilleiguaran/643086 to your computer and use it in GitHub Desktop.
Carrito de Compras Simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* se recupera el carrito de la variable de sesión */ | |
$carrito = $_SESSION['carrito']; | |
/* acá se harian las operaciones de agregar/quitar del carrito */ | |
/* se guardan las modificaciones en la variable de sesión */ | |
$_SESSION['carrito'] = $carrito; | |
?> | |
<html> | |
... | |
<table> | |
<th> | |
<td>ID</td> | |
<td>Cantidad</td> | |
</th> | |
<?php | |
/* Se recorre los item del carrito y se muestran */ | |
foreach($carrito as $id => $cantidad) | |
{ | |
?> | |
<tr> | |
<td><?php print $id; ?></td> | |
<td><?php print $cantidad; ?></td> | |
</tr> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment