PDA

View Full Version : creating a quiz



Soren Twilight
06-29-2006, 06:43 PM
I need help creating a quiz of a sort. Let's say this quiz consists of 10 multiple choice questions with one correct answer each. After the user finishes the quiz they press a button at the bottom of the page that might state 'continue' (if the user has not filled out the entire quiz an alert should pop-up and tell them). If the user has answered 90% or better correct they will be directed to a certain page and if not they will be directed to a different page.

Can someone help me?

djr33
06-29-2006, 08:48 PM
You're posting in javascript. This would be better handled by php for a few reasons:
1. javascript can't store data; you'd need to use cookies to send to the next page, or hidden form values (which would get tedious)
2. php is more secure
3. php is designed to work with forms while javascript is certainly less designed to.
4. php has hidden source code while javascript's source is viewable, so they could cheat by looking at the source.

The main thing that is hard about the whole thing is scoring it/keeping track of old guesses.
do you need a score at the end or just a redirect?

What I'd suggest is, if you don't need a score, just... if the user gets a single question wrong, store that in a cookie. If they get two, then the cookie will read "2" and, when they reach the final page, it will direct them to another page. The people without the "2" or more in the cookie will go to the winners page, or whatever.
If you need a score, just base it off of that, but for each question, not just until 2 are wrong (they fail... below 90%).