Store Quiz scores in session

From: Date: Wed, 28 Apr 2004 15:40:15 +0000
Subject: Store Quiz scores in session
Groups: php.general 
Request: Send a blank email to php-general+get-184891@lists.php.net to get a copy of this message
Hello All, I am designing a PHP based quiz w/o any MySQL back end ( at least for now). There will be a multiple choice quiz which a user can take after reading some material. Each quiz will have 10 questions and the quiz-taker will be required to answer ALL the questions correctly to pass the quiz. My idea is to create 10 separate PHP pages (to check to see if the person has been successfully logged in to the site etc. ) for each of the 10 questions. If the user answers a question correctly, I will set a session variable called 'correct_count' to 1. if the user answers the next question correctly then this variable is incremented other wise it is left as it is. At the end of the quiz, I'l compare the variable to see if it is equal to 10, if so then the user will have passed the quiz. My question would be: 1. Is it possible to vary session variables across multiple pages 2. Or it is better to use a Session Array that holds 10 entries (and then do the comparison) 3. Is there any other better approach to attack the above scenario. I need to get this up and ready v soon, so I am not going to bother about storing the results in a DB. All suggestions are most welcome. Thanks in advance Pushpinder Singh

« previous php.general (#184891) next »