Ver Mensaje Individual
  #5 (permalink)  
Antiguo 04/04/2009, 07:08
andystefano2
 
Fecha de Ingreso: marzo-2009
Mensajes: 35
Antigüedad: 15 años, 1 mes
Puntos: 0
De acuerdo Respuesta: como recibir los datos de varios checkbox con el mismo nombre en php c

hey man justo estaba trabajando en eso...ahi te va un ejemplo.


Formulario Html:

array.html
Código HTML:
<form id="form1" name="form1" method="post" action="array_recive.php">
  <label>Casilla 1
  <input name="casilla[]" type="checkbox" id="1" value="1" />
  </label>  
  
    <label>Casilla 2
  <input name="casilla[]" type="checkbox" id="1" value="2" />
  </label>
  
    <label>Casilla 3
  <input name="casilla[]" type="checkbox" id="3" value="3" />
  </label>
  
    <p>
      <label>
      <input type="submit" name="button" id="button" value="Enviar" />
      </label>
  </p>
</form> 
formulario php que recive:

array_recive.php

Código PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Array - recive</title>
</head>

<body>
<?
    
foreach ($_POST['casilla'] as $value){
    echo 
$value;
}
// $arr is now array(2, 4, 6, 8)
unset($value);


?>
</body>
</html>