I want to get the values that belong to the answers of a test. There could be any number of questions. A question has the HTML:
<form method='post' action='calificar.php'>
<div class='pruebaAlumno'>
<h5>Pregunta 3</h5>
<h3>¿Que factores definen la capacidad de una persona?</h3>
<input type='checkbox' name='respuestaAlumno[]'
value='Voluntad'> Voluntad <br>
<input type='checkbox' name='respuestaAlumno[]'
value='Cultura'> Cultura <br>
<input type='checkbox' name='respuestaAlumno[]'
value='Hábitos'> Hábitos <br>
<input type='checkbox' name='respuestaAlumno[]'
value='Habilidad'> Habilidad <br>
<input type='checkbox' name='respuestaAlumno[]'
value='Perfil'> Perfil <br>
<input type='checkbox' name='respuestaAlumno[]'
value='Dones'> Dones <br>
<input type='hidden' name='idPregunta' value='41'>
<input type='hidden' name='tipo' value='C'>
</fieldset>
</div> <div class='calificar'>
<input type='submit' name='calificar' value='enviar' >
</div>
</form>
I want to get
- Answer (respuestaAlumno)
- questionID (idPregunta)
- type (tipo)
from each question.
Then I want to save the data in an array.
A test can have as many questions as the teacher wants. The form has one submit button.
I´ve tried to get the data in different ways. Using JS DOM. Using POST.
I´ve found some PHP DOM tutorials but them all teach how to modify an static HTML.
Please help me to get the submitted data from each fieldset.
Thanks in advance.