Hi, i made this quiz, and it always displays that i got 20% no matter what i do, please help.
[php]
if ($action == “true”) { $right = 0;
print (“thank you for taking my quiz”);
if (answer_1 == $q[0]) { $right++; }
if (answer_2 == $q[1]) { $right++; }
if (answer_3 == $q[2]) { $right++; }
if (answer_4 == $q[3]) { $right++; }
if (answer_5 == $q[4]) { $right++; }
$percentage = ($right / 5) * 100;
print(“
You scored $percentage % on the quiz!”); exit; }
?>
Question 1: A string is ...
<? print ($q1_bad[0]) ?>
<? print ($q1_bad[1]) ?>
<? print ($q1_bad[2]) ?>
Question 2: An array is …
Question 3: Building a form primarily requires …
<? print ($q3_bad[0]); ?>
<? print ($q3_bad[1]); ?>
<? print ($q3_bad[2]); ?>
Question 4: This script is an example of …
Question 5: Before generating random numbers, you use …
<? print ($q5_bad[0]); ?>
<? print ($q5_bad[1]); ?>
<? print ($q5_bad[2]); ?>
[/php]