I assume that the quiz is objective type… so here is the simple set up for it
the database table for questions can be like the following
question_id int primary key
correctanswer int // it stores the correct answer’s option position (1 if opt a is correct, 2 if optb is… like that)
step - 2
In the quiz program form design, while displaying the questions, i assume u give options in radio buttons right? so, in the value attribute of the answers, u can give the position numbers as values …i.e., value=“1” for opt-a, and display the text from table… value “2” for opt-b and like wise.
so, when user selects any one option… you would get the position of the answer he chose.
Mind you, u dont have to get the answer text on the whole coz, he is not typing it… the answer is already there the user is just choosing it. so, u only need to know which one he chose and not the total answer itself.
when the user submits the quiz form, now in the post data, u will have question id and its compared answer given by the user…
now, u can do something like this
foreach($question_id as $q)
$rs = mysql_query(“select correctanswer from questions where questionid=”.$q);
$row = mysql_fetch_assoc($rs);
// do something…
this can give u an idea on how it can be done… sure this is not a copy-paste-ready solution…though.