thanks for this
I have been playing around with the code to try to make it match what I am trying to do, but can't quite get there - could you help - thanks;
code on quiz form
<p>In order to assess your current leadership skill level, please complete
the following form.<br>
Once you have completed this form you will get instant feedback on your
results.
<form name="leadership" method="post" action="process_leadership.php">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#FFEFE8">
<td width="13%">First Name:</td>
<td colspan="2"> <b>
<input type="text" name="first_name" size="40">
</b></td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%">Second Name:</td>
<td colspan="2"> <b>
<input type="text" name="second_name" size="40">
</b></td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%">E-Mail:</td>
<td colspan="2"> <b>
<input type="text" name="email" size="40">
<br>
</b>A Copy Of Your Results Will Be Sent To You In An E-mail, <br>
So Please Ensure This Is A Valid E-Mail Address - Thank You </td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%" bgcolor="#FEAB6D">Question 1</td>
<td colspan="2" bgcolor="#FEAB6D"><b>A good leader is a good coach
as well. </b></td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%" rowspan="2"> </td>
<td width="13%" height="2">
<p align="right"><b>TRUE</b></p>
</td>
<td width="74%" height="2">
<input type="checkbox" name="qt[1]" value="true">
</td>
</tr>
<tr>
<td width="13%" bgcolor="#FFEFE8">
<div align="right"><b>FALSE</b></div>
</td>
<td width="74%" bgcolor="#FFEFE8">
<input type="checkbox" name="qf[1]" value="false">
</td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%" bgcolor="#FEAB6D">Question 2</td>
<td colspan="2" bgcolor="#FEAB6D"><b>The person in charge of a unit
is always its leader. </b></td>
</tr>
<tr bgcolor="#FFEFE8">
<td width="13%" rowspan="2"> </td>
<td width="13%" height="2">
<p align="right"><b>TRUE</b></p>
</td>
<td width="74%" height="2">
<input type="checkbox" name="qt[2]" value="true">
</td>
</tr>
<tr>
<td width="13%" bgcolor="#FFEFE8">
<div align="right"><b>FALSE</b></div>
</td>
<td width="74%" bgcolor="#FFEFE8">
<input type="checkbox" name="qf[2]" value="false">
</td>
</tr>
// etc.etc.etc. for 12 questions
code to process form and give feedback
// count up the correct number of right answers
$answers = array(
1 => 'false',
2 => 'false',
3 => 'false',
4 => 'false',
5 => 'false',
6 => 'false',
7 => 'false',
8 => 'false',
9 => 'false',
10 => 'false',
11 => 'false',
12 => 'false'
);
$i = 0;
foreach ($answers as $key => $value)
{
if (!isset($_POST['Submit'][$key]))
{
if ($value == $_POST['qf'][$key]) { $i++;}
}
}
echo '<br>You got ' . $i . ' out of ' . count($answers) . ' correct.';
IF (isset($_POST['qt[1]']))
{echo 'Question 1
The right answer was False.
A good leader need not be a good coach as well. <br>
Let\'s be clear about what leadership is fundamentally. <br>Leadership is basically about showing others the direction
to follow, either by getting somewhere first and setting an example or by indicating the direction. <br>Coaching is a nice
skill to have, but leaders don\'t have to have it and those who do aren\'t necessarily good leaders. Coaching is mainly
used for developing people, not for influencing them to change direction.';}
ELSE
{echo 'Question 1 - You got this correct. A good leader need not be a good coach as well.';}
echo '<p></p><p></p>';
IF (isset($_POST['qt[2]']))
{echo 'Question 2
The right answer was False.
The person in charge of a unit does not have to be its leader. <br>Determining direction is increasingly a knowledge
based skill. In any group, different people will have different knowledge. Any one of them can take the lead
on a topic on which they are the expert. Leadership is no longer a monopoly of the one person in charge.';}
ELSE
{echo 'Question 2 - You got this correct. The person in charge of a unit does not also have to be its leader.';}
// etc.etc.etc. for 12 questions
the code runs OK (no errors) but isn't counting correctly so I do not get the correct number of 'right answers' back.
also the code where I try to output the response for each question just isn't happening, it just outputs the else statment.