A tricky little problem

From: Date: Thu, 15 Jun 2006 09:30:29 +0000
Subject: A tricky little problem
Groups: php.general 
Request: Send a blank email to php-general+get-238065@lists.php.net to get a copy of this message
I have a multiple choice quiz where the questions & answers are extracted from an external file $q1 = "what is the capital of Scotland "; $a1 = "Edinburgh"; $b1 ="Glasgow"; $c1 ="dundee"; $d1 ="Stirling"; $q1_answer = $a1; $q2 = "what is the capital of France"; $a2 = "Lyon"; $b2 ="Paris"; $c2 ="Carcassonne"; $d2 ="Madrid"; $q2_answer = $b1; ?> These are fed into a page which displays the questions and displays a radio button to select the answer, the page is incremnted when a correct answer is given if ($_POST['x']== $q1_answer) { $incrementedPage = $page + 1; header("Location: evaluation.php?page=$incrementedPage"); } but how can I insert and compare the next question? table width="292" border="0"> <tr> <td width="19">A:</td> <td width="202"><?=$a1; ?></td> <td width="57" align="left"><div align="left"> <input type="radio" name="x" value="<?=$a1; ?>" /> </div></td> </tr> <tr> <td>B:</td> <td><?=$b1; ?></td> <td align="left"><div align="left"> <input type="radio" name="x" value="<?=$b1; ?>" /> </div></td> </tr> <tr> <td>C:</td> <td><?=$c1; ?></td> <td align="left"><div align="left"> <input type="radio" name="x" value="<?=$c1; ?>" /> </div></td> </tr> <tr> <td>D:</td> <td><?=$d1; ?></td> <td align="left"><div align="left"> <input type="radio" name="x" value="<?=$d1; ?>" /> </div></td> </tr> <tr> <td colspan="2">&nbsp;</td> <td align="left"><input type="submit" name="Submit" value="Submit" /></td> </tr> </table>

« previous php.general (#238065) next »