form with dynamic questions

form with dynamic questions

am 07.10.2006 04:51:19 von toffee

Hi all,

I've a mysql table where i stored a list of questions. My php script
executes a query which yields a different number of questions every time; i
used the loop function to create an input field for each question in the
form; and dynamically referencing each input name with the question number
i.e. question 1 is called q1, question 2 named q2, and so on.
The data is submitted using POST. I then try to retrieve all the answers by
doing a loop and using something like echo '$_POST['q'.$n.'']'; except the
syntax doesnt seem to work.
Can anyone please tell me what am doing wrong - or a better way of doing
this.

Many thanks

T