Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2004, 13:13
neogeo
 
Fecha de Ingreso: febrero-2004
Ubicación: Chillán
Mensajes: 35
Antigüedad: 20 años, 2 meses
Puntos: 0
Pregunta Como agrego mas ...? en este codigo

<?php
session_start();
session_register('itemsEnCesta');
if ($item){
if (!isset($itemsEnCesta)){
$itemsEnCesta[$item]=$cantidad;
}else{
foreach($itemsEnCesta as $k => $v){
if ($item==$k){
$itemsEnCesta[$k]+=$cantidad;
$encontrado=1;
}
}
if (!$encontrado) $itemsEnCesta[$item]=$cantidad;
}
}
?>
<html>
Quisiera saber como agrego mas valores a este carro, o sea, me permite guardar nombre del producto y cantidad, y yo quisiera agregarle categoria, tipo y otros datos mas.

En que parte hago las modificaciones, tirenme un salvavidas, gracias.

<body>
<tt>
<form action="<?=$PHP_SELF."?".SID?>" method="post">
Dime el producto <input type="text" name="item" size="20"><br>
Cuantas unidades <input type="text" name="cantidad" size="20"><br>
<input type="submit" value="Añadir a la cesta"><br>
</form>
<?
if (isset($itemsEnCesta)){
echo'El contenido de la cesta de la compra es:<br>';
foreach($itemsEnCesta as $k => $v){
echo 'Artículo: '.$k.' ud: '.$v.'<br>';
}
}
?>
</tt>
</body>
</html>