Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/02/2014, 13:57
kai89
 
Fecha de Ingreso: enero-2010
Mensajes: 373
Antigüedad: 14 años, 3 meses
Puntos: 5
Respuesta: Validar input radio y contar los seleccionados

No pasa nada si lo sacas del for, antes estaba asi.

Ahora funciona, lo que pasa esque no suma, es decir aunque selecciones un boton o selecciones tres, solo te suma el primero,
Y yo quiero que para poder procesar el formulario hayas tenido que seleccionar los tres no solo uno, que es como funciona ahora.



Mira el html es este:
Cita:
<?
$preguntas=0;
while($preguntas++ < 3 ) {



?>

<div >
<span ><strong><?=$preguntas?>.</strong></span><span class="preg_text"><input type="text" style="width:973px;" name="Pregunta<?=$id++?>" onfocus="this.value = (this.value == 'Escriba la pregunta) ? '' : this.value" value='Escriba la pregunta'/></span><br />

<div style="margin-top:5px; ">
<? print "<input type=\"radio\" name=\"rregunta".$preguntas."\" value=\"a\" />\n";
?>
<strong>a)</strong> <input type="text" name="Pregunta<?=$id++?>" style="width:530px;" onfocus="this.value = (this.value == 'Respuesta a') ? '' : this.value" value='Respuesta a'/>

</div>

<div style="margin-top:5px; " >
<? print "<input type=\"radio\" name=\"rregunta".$preguntas."\" value=\"b\" />\n";
?><strong>b)</strong><input type="text" name="Pregunta<?=$id++?>" style="width:530px; margin-left:3px;" onfocus="this.value = (this.value == 'Respuesta b') ? '' : this.value" value='Respuesta b'/>

</div>


<div style="margin-top:5px; " >
<? print "<input type=\"radio\" name=\"rregunta".$preguntas."\" value=\"c\" />\n";
?><strong>c)</strong> <input type="text" name="Pregunta<?=$id++?>" style="width:530px;" onfocus="this.value = (this.value == 'Respuesta c') ? '' : this.value" value='Respuesta c'/>
</div>

<div style="margin-top:5px; margin-left:5px; " >
<textarea type="text" name="Pregunta<?=$id++?>" style="width:404px; height:70px;" onfocus="this.value = (this.value == '>Escriba una explicacion') ? '' : this.value" />Escriba una explicación</textarea>
</div>



</div><!--Fin div -->

<?

}//*************** Fin while
?>