A tricky little problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux