Cita:
Iniciado por pateketrueke
Imprime lo valores de tus variables y comprueba que realmente son lo que crees.
Cita:
Iniciado por jonn59
Coincido con el comentario anterior, imprime el valor de tus variables para que sepas que es lo que realmente esta llegando de tu formulario, como estas obteniendo tus variables con $_GET[] ó $_POST[] ????
pateketrueke y jon59, las variables llegan bien, ya que hice un echo con esos datos y me llegan correctamente
Cita:
Iniciado por andresdzphp
![Pensando](http://static.forosdelweb.com/fdwtheme/images/smilies/scratchchin.gif)
en que lado recibes los valores del formulario? los envias por POST o GET? de donde salen las variables $edad2 y $sexo?
andres, los valores los recibo por un post del formulario, el cual tiene el siguiente código:
Código HTML:
Ver original<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript">
function validar(){
//hago validacion edad
edad2= document.getElementById('edad').value;
if (edad2==""){
alert("Por favor introduzca su edad.")
return false;
}else{
if (edad2<18){
alert("Debe ser mayor de 18 años.")
return false;
}else{
if( isNaN(edad2) ) {
alert("Por favor introduzca una edad correcta.")
return false;
}
}
}
//hago validacion Radiobutton
sexo2= document.getElementsByName('sexo');
var seleccionado = false;
for(var i=0; i<sexo2.length; i++) {
if(sexo2[i].checked) {
seleccionado = true;
break;
}
}
if(!seleccionado) {
alert("Por favor indiquenos su sexo.")
return false;
}
}
<body><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <td><form action="paso2b.php" method="post" name="envio" target="_new" id="envio" onSubmit="return validar();"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <td align="center">Edad:
</td> <input name="edad" type="text" id="edad" maxlength="2" /></td> <td align="center">Sexo:
</td> <input type="radio" name="sexo" value="1" id="sexo_0" /> <input type="radio" name="sexo" value="0" id="sexo_1" /> <td align="center"> <input type="submit" name="paso2" id="paso2" value="Continuar" /></td>