
21/06/2009, 11:21
|
| | Fecha de Ingreso: junio-2009
Mensajes: 7
Antigüedad: 15 años, 8 meses Puntos: 0 | |
Respuesta: error en carrito Hola, he cogido un carrito que he visto en una web pero cuando lo ejecuto, no me sale la tabla, aqui os dejo el codigo:
<?php
session_start();
error_reporting(E_ALL);
@ini_set('display_errors', '1');
if(isset($_SESSION['carro']))
$carro=$_SESSION['carro'];else $carro=false;
?>
<html>
<head>
<title>PRODUCTOS AGREGADOS AL CARRITO</title>
</head>
<body>
<h1 align="center">Carrito</h1>
<?php
if($carro){
?>
<table width="720" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#333333" class="tit">
<td width="105">Nombre</td>
<td width="207">Precio</td>
<td colspan="2" align="center">Stock</td>
<td width="100" align="center">Borrar</td>
<td width="159" align="center">Actualizar</td>
</tr>
<?php
$color=array("green","yellow");
$contador=0;
$suma=0;
foreach($carro as $k => $v){
$subtotal=$v['stock']*$v['precio'];
$suma=$suma+$subtotal;
$contador++;
?>
<form name="a<?php echo $v['identificador'] ?>" method="post" action="agregarcar.php?<?php echo SID ?>" id="a<?php echo $v['identificador'] ?>">
<tr bgcolor="<?php echo $color[$contador%2]; ?>">
<td><?php echo $v['nombre'] ?></td>
<td><?php echo $v['precio'] ?></td>
<td width="43" align="center"><?php echo $v['stock'] ?></td>
<td width="136" align="center">
<input name="stock" type="text" id="stock" value="<?php echo $v['stock'] ?>" size="8">
<input name="id" type="hidden" id="id" value="<?php echo $v['id'] ?>"> </td>
<td align="center"><a href="borracar.php?<?php echo SID ?>&id=<?php echo $v['id_producto'] ?>"><img src="Imagenes/Carrito/borrar.gif" width="12" height="14" border="0"></a></td>
<td align="center">
<input name="imageField" type="image" src="Imagenes/Carrito/actualizar.jpg" width="20" height="20" border="0"></td>
</tr></form>
<?php
}
?>
</table>
<div align="center">Total: €<?php echo number_format($suma,2);
?>
</div><br>
<div align="center">Continuar comprando
<a href="productos.html?<?php echo SID;?>">
<img src="Imagenes/Carrito/continuar.gif" width="13" height="13" border="0"></a>
</div>
<?php } ?>
</body>
</html> |