Hi I am trying to display information from a form, the number of question and number of choices are dynamically generated by the user. The form is as follows:
<input name='questions[]' type='text' value='question 1' /><br/>
<input name='choice[1-1][]' type='text' value='option 1' /><br/>
<input name='choice[1-1][]' type='text' value='option 2' /><br/>
<input name='choice[1-1][]' type='text' value='option 3' /><br/>
<input name='questions[]' type='text' value='question 2' /><br/>
<input name='choice[2-1][]' type='text' value='option 1' /><br/>
<input name='choice[2-1][]' type='text' value='option 2' /><br/>
<input name='choice[2-1][]' type='text' value='option 3' /><br/>
etc...
I have had no problems with creating the code to generate the form, my problem lies in the displaying the information which the uses puts into the form.
So far I have tried using a foreach loop to display the question then another foreach loop to display the choices. I have also tried using the count() then using a for loop to count through the number of choices and output them that way, with no success.
My problem is that when I try to display the choices, they are all displayed before the next question is displayed and then all the choices are displayed again, before the script moves onto the next question and so on.