I have 10 question at a time on a page quiz.html- i.e
question 1: what is your name?
<option value="a">a</option>
<option va..>b</option>...
<option va...>e</option>
question 2: what are the colors in usa flag?
<option>a</option>
and so on.
My question is how do i submit this question at a time and add +1
into the score field in the database for each correct answer?
I can do the saving and scoring if there is only 1 question per page i.e
select * from quiz where id='qid'
then
while($fetch=mysql_fetch_row($query)){
if( $fetch["answer"]==$useranswer ){ add +1 to his score; }
}
But for many question i don't know what to do.
The structure of the html is:
<form action="quizer.php" method="post">
<input type="hidden" name="q1" value="qid"> what is your name?
<option value="a">rolex</option>
<option value="b">wales</option>
<option value="c">israel</option>
<option value="d">ade</option>
<br>
<input type="hidden" name="q2" value="qid">
is nigeria a country?
<option value="a">no</option>
<option value="b">yes</option>
and so on...
<input type="submit">
</form>