Cita:
Iniciado por pateketrueke
Eso es normal, porque el name que usas es único.
Si deseas capturar varios checkbox entonces el name debería ser así: form_aficion[]
Y desde luego, lo que recibes es un array, por lo tanto debes imprimirlo con un bucle.
![apachar ojo](http://static.forosdelweb.com/fdwtheme/images/smilies/wink.png)
Me convencio tu respuesta pateketrueke, pero lo que pasa es que soy muy novato en la programacion y apenas le ando entendiendo jejeje si me pudieras corregir mi codigo te lo agradeceria mucho, es que nomas eso me falta de que imprima bien.
Mira el codigo del HTML es:
<!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=iso-8859-1" />
<title>Documento sin título</title>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<form id="form_datos" name="form_datos" method="post" action="practica8.php" />
<h1> Formulario de datos personales </h1> <br/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%"> <label> Nombre: <br/>
<input type="text" name="form_nombre" id="form_nombre" />
</label>
</td>
<td width="14%"> <label> Apellidos: <br/>
<input type="text" name="form_apellidos" id="form_apellidos" />
</label>
</td>
<td width="70%">
<label>
<select name="form_edad" size="1" multiple="multiple" id="form_edad">
<option>menor de 18</option>
<option>mayor de 18</option>
</select>
</label>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%"> <label> <br />
<br />
Peso: <br/>
<input type="text" name="form_peso" id="_form_peso" /> Kg.
</label>
</td>
<td width="14%">
<label> Sexo: <br/>
<input type="radio" name="form_sexo" value="Hombre" id="form_sexo_0" />
Hombre </label> <br/>
<label>
<input type="radio" name="form_sexo" value="Mujer" id="form_sexo_1" />
Femenino </label>
</td>
<td width="70%">
<label> <br/> Estado civil: <br/>
<input type="radio" name="form_estado" value="Casado" id="form_estado_0" />
Casado </label> <br/>
<label>
<input type="radio" name="form_estado" value="Soltero" id="form_estado_1" />
Soltero </label> <br/>
<label>
<input type="radio" name="form_estado" value="Divorciado" id="form_estado_2" />
Divorciado </label> <br/>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"> <label> <br/> Aficiones: <br/>
<input type="checkbox" name="form_aficion[]" value="Cine" id="form_cine_0" />
Cine </label>
<label>
<input type="checkbox" name="form_aficion[]" value="Deporte" id="form_deporte_1" />
Deporte </label>
<br/>
<label>
<input type="checkbox" name="form_aficion[]" value="Literatura" id="form_literatura_2" />
Literatura </label>
<label>
<input type="checkbox" name="form_aficion[]" value="Teatro" id="form_teatro_3" />
Teatro </label>
<label>
<input type="checkbox" name="form_aficion[]" value="Musica" id="form_musica_4" />
Musica </label>
</td>
<td width="65%"> </td>
<td width="10%"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%"> <br/> <br/>
<label>
<input type="reset" name="f_limpiar" id="f_limpiar" value="Limpiar" />
</label>
</td>
<td width="70%">
<br/> <br/>
<label>
<input type="submit" name="f_Enviar" id="f_Enviar" value="Enviar" />
</label>
</td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
Y del script del PHP es:
<!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=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<?php
$nombre =$_POST['form_nombre'];
$apellidos =$_POST['form_apellidos'];
$edad =$_POST['form_edad'];
$peso =$_POST['form_peso'];
$sexo =$_POST['form_sexo'];
$estado =$_POST['form_estado'];
$mensaje= "$nombre, $apellidos, $edad, $peso, $sexo, $estado, $aficion";
print $mensaje;
?>
</body>
</html>
Lo que no me imprime es la aficion y la edad y pues ya no hayo ni que hacer