Multiple choice quiz:
I have six questions (Q1, Q2, Q3, Q4, Q5, Q6)
the answers are stored in six fields in a database.
If a student answers eg two questions and logs out, when he logs back in, I want to say "hello, begin again at question three".
I thought I could do this by finding the first empty field in the database? But I don't know how to do that.
I can do it by getting all the fields and writing (pseudocode) '...if Q2 is not empty, echo "hello, begin again at question three" EXIT. (so it doesn't go onto Q3)
And this works ok. Except that EXIT (or DIE or RETURN) kills the code and my page footer disappears.
I know this isn't explained well at all and it's probably the wrong approach?
If anyone's able to decipher it, here's the actual code:
<?php
if($row_Recordset1['m1q1'] !="") {echo "You have answered Question... ";}
if($row_Recordset1['m1q1'] !="") {echo "1, ";} else {echo "Begin Module"; exit;} if($row_Recordset1['m1q2'] !="") {echo "2, ";} else {echo "go to 2"; exit;} if($row_Recordset1['m1q3'] !="") {echo "3, ";} else {echo "go to 3"; exit;} if($row_Recordset1['m1q4'] !="") {echo "4, ";} else {echo "go to 4"; exit;} if($row_Recordset1['m1q5'] !="") {echo "5, ";} else {echo "go to 5"; exit;} if($row_Recordset1['m1q6'] !="") {echo "6. You have completed this module."; exit;} else {echo "go to 6"; exit;}
?>
<?php include('footer.php'); ?>