Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/03/2004, 08:05
Avatar de claudiovega
claudiovega
 
Fecha de Ingreso: octubre-2003
Ubicación: Puerto Montt
Mensajes: 3.667
Antigüedad: 20 años, 6 meses
Puntos: 11
Un ejemplo:

script1: precios.php

<form name="precios" action="suma.php" method="post">
$ 500: <input type="checkbox" name="precio[]" value=500>
$ 600: <input type="checkbox" name="precio[]" value=600>
<input type="submit" name="enviar" value="Enviar">
</form>

script2: suma.php

if($_POST['precio'])
{
echo array_sum($_POST['precio']);
}

en precios.php se crea un arreglo a partir de los valores de los checkbox gracias al nombre dado al checkbox, en suma.php se usa la funcion array_sum() que suma un arreglo.