[OT] programming question

David Precious davidp at preshweb.co.uk
Thu Apr 26 09:30:36 BST 2007

Nicholas Clark wrote:
> Say I'm trying to write a web based quiz. Multiple guess.
> What I think I want to do is have my backend take the list of possible answers
> and display them in random order. My HTML form has $n radio buttons, with $n
> form parameter options, and (obviously) only one is correct.
> Now, the simplest way I can see of saving state long term is to have it so
> that the master file of questions has answers in fixed order, so that one
> maps the radio option chosen back to the fixed location of that answer.
> And the simplest way of knowing the correct answer is to have it first in
> the unrandomised order. Only, here we have an information leakage problem,
> because something like

How are you storing the questions/answers?  Any reason you can't just 
have a flag to indicate which answer(s) are correct?  (Giving the 
ability to have more than one correct answer might prove useful at some 
point, perhaps?).


Dave P

David Precious
http://blog.preshweb.co.uk/ :: http://www.preshweb.co.uk/

More information about the london.pm mailing list