Results 1 to 2 of 2

Thread: creating a quiz

  1. #1
    Join Date
    Jul 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default creating a quiz

    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?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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%).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •