Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/08/2010, 15:22
wilmer30
 
Fecha de Ingreso: enero-2010
Mensajes: 491
Antigüedad: 14 años, 3 meses
Puntos: 12
Respuesta: pasar checkbox tildados y no tildados

Decía:
Código PHP:
<? 
if(isset($_POST['button'])){
foreach( 
$_POST['habilitar'] as $key => $value ) {
   echo 
"Key: $key; Valor: $value<br>";
}
}
?>
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <input name="habilitar[]" type="checkbox" id="asda" value="0" checked /> asdfasd<br />
  <input type="checkbox" name="habilitar[]" id="asda" value="1" />asdfasd <br />
  <input type="checkbox" name="habilitar[]" id="asda" value="0"/>asdfasd <br />
  <input type="checkbox" name="habilitar[]" id="asda" value="0" /> asdfasd<br />

  <input type="submit" name="button" id="button" value="Enviar" />

</form>
</body>
</html>