I am in the process of setting up a little module where if the user loggin in last logged in at a certain date then he has to answer 10 options questions before being authenticated. 10 questions will be options and multiple choice.
Wondering If i can get some advice in setting this up. I want to store the 10 questions and answers for each of them into the DB so if questions or answers are changed then code doesnt need to be changed.
I was thinking about having two tables Questions, Answers (one column will have correct answer for question) which will be joined by a pkey (is this the best table structure for this?)
my code (Java) will get each question and answers and store them into a Hash for each question (is this the best datastructure for this?)
then the view layer will have a outer loop which will loop over the questions and an inside loop which will loop over the answers for each question. Should I store the real answer as a hidden html variable? or go to the DB again when user clicks submit so that I can match the answers?
any suggestions would help.