On Thu, October 5, 2006 5:36 am, Ryan A wrote:
> 2. I have noticed if you are displaying 4 (a-d) choices and the answer
> for question 10 (for example) is always on choice B it kind of sticks
> in the head and students dont really read everything they just
> memorize the location of the answer (maybe unconsciously) and click
> that.. i have an idea of making the answers "jump around"
So put them out in random order.
[shrug]
> I thought of having a hidden text box everytime for each question...
> but that can be quite easily found out... any other suggestions?
Don't send the correct answer to the browser at all.
And don't tie the "ABCD" to the correct answer.
<?php
$question[47] = "Which animal flies around at night and sleeps in
the day?"
$answer[13] = 'cat';
$answer[14] = 'dog';
$answer[15] = 'trout';
$answer[16] = 'bat';
$correct[47] = 'bat';
?>
Your HTML could look like this:
A <input type="radio" name="q[47]" value="cat" /> cat
B <input type="radio" name="q[47]" value="dog" /> dog
C <input type="radio" name="q[47]" value="trout" /> trout
D <input type="radio" name="q[47]" value="bat" /> bat
To test if the answer is correct:
$q = $_REQUEST['q'];
foreach($q as $index => $a){
if ($correct[$index] == $a) echo "CORRECT";
else echo "INCORRECT: Correct is $correct[$index]";
echo "<br />\n";
}
You could also use the index to $answer as the value with:
$correct[47] = 16;
<input type="radio" name="q[47]" value="16" /> bat
if ($correct[$index] == $a){
and all the other code the same.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php