Re: Testing people

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

 



Thats why I love this list... people share and help so unselfishly.
Thanks Rich, sure didnt think of the way you wrote the solution till i read your code!

Have a fab one!



Richard Lynch <ceo@xxxxxxxxx> wrote:
> 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.

  $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]  cat
B  [input]  dog
C  [input]  trout
D  [input]  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 "
\n";
}

You could also use the index to $answer as the value with:
$correct[47] = 16;
 [input]  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?




------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

[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