Hi all,
I have created a form with radio buttons. The user must answer 4 multiple choice questions. Each question contains 3 choices(Radio Buttons)
The user hits submit and it taken to php page that processes the info.
In this page I want to check that the user has selected the correct box.
Here is my code:
<?php
// declare variables (q1, etc are names of question)
$q1 = $HTTP_POST_VARS['q1'];
$q2 = $HTTP_POST_VARS['q2'];
$q3 = $HTTP_POST_VARS['q3'];
$q4 = $HTTP_POST_VARS['q4'];
$i= newArray($q1, $q2, $q3, $q4);
$ans = Array(0, 0, b, 0);
for ($i=0; $i<=3; $i++)
{
if ($i[]==$ans[])
{
echo 'Correct';
}
else echo 'Eeergh';
}
?>
What am I doing wrong here? I put the 4 questions in an array. Do the values pass in also?
I then created another array for the correct answers: $ans
Then I use a for loop to compare the users selection with the correct answers.
Please help me.
thanks..
Kevin.