SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript for quiz?

    I have a MySQL database table with multiple choice questions and want to add a quiz to an existing website. One round of the quiz would mean pulling 20 random questions from a selected category and answer the questions one by one. The faster a correct answer is given, the more points you get. To prevent cheating I don't want the correct answer to be revealed in the page source code.

    Any ideas on how I can do this the easy way. My plan is to use JavaScript for the Quiz. To check the answers without revealing the correct answer in the page source code I thought AJAX could be a solution but I have never used AJAX. I have built the site using PHP and MySQL and a little JavaScript but I'm a beginner at this so before I before I start building the quiz I'm looking for some advice on what technique to use.

    Thank you in advance for any advice on this.

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hy,
    Another solution, if the annswers are shorts, is to add the answer with php encripted md5, then, with JS functions for MD5, will encript the user's answer and make comparations with the one from php.
    You can find on the net "MD5 JavaScript functions".
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners

  3. #3
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your reply, but I don't understand how I can have the answers shown as multiple choice alternatives if they are encrypted?

  4. #4
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The ideea is to make a JavaScript Array with the correct answers, encripted each correct answer.
    Then, when the user adds an answer, the JS encripts it and checks in that Array if there is the same encripted answer.
    Or, if this is not a solution, try with Ajax, maybe is better to learn Ajax too. Look for "Free Ajax Course".
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners


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
  •