nade93 Posted April 14, 2010 Share Posted April 14, 2010 Hi All been battering my head against a wall with this so need some help if you can. I want to build a multiple choice quiz that has: 1. 10 questions 2. each question has 6 checkboxes they must choose from 3. there are three correct checkboxes and three incorrect 4. on submission, i want to be able to check if the right checkboxes are recorded then pass and save their score to a database and produce their results. I am running their questions from a database and works fine, its the correct and count and inserting score to database i am really struggling with. Can anyone please help? thanks in advance! Link to comment https://forums.phpfreaks.com/topic/198502-php-multiple-choice-quiz-with-answer-count-etc/ Share on other sites More sharing options...
conker87 Posted April 14, 2010 Share Posted April 14, 2010 You should use sessions. session_start(); // at the top of your page(s) $_SESSION['score1'] = $score1; $_SESSION['count']++; Link to comment https://forums.phpfreaks.com/topic/198502-php-multiple-choice-quiz-with-answer-count-etc/#findComment-1041592 Share on other sites More sharing options...
nade93 Posted April 14, 2010 Author Share Posted April 14, 2010 I am using sessions already to record whether the person is logged in or not and to record their activity while on here, how can i integrate this also? Link to comment https://forums.phpfreaks.com/topic/198502-php-multiple-choice-quiz-with-answer-count-etc/#findComment-1041610 Share on other sites More sharing options...
nade93 Posted April 14, 2010 Author Share Posted April 14, 2010 also i need something that passes the info through the checkboxes sorry to bump guys but getting no where fast with this! Link to comment https://forums.phpfreaks.com/topic/198502-php-multiple-choice-quiz-with-answer-count-etc/#findComment-1041690 Share on other sites More sharing options...
Ken2k7 Posted April 14, 2010 Share Posted April 14, 2010 also i need something that passes the info through the checkboxes sorry to bump guys but getting no where fast with this! Use an array. Example: xHTML <input type="checkbox" name="cb[]" value="1" /> <input type="checkbox" name="cb[]" value="1" /> <input type="checkbox" name="cb[]" value="1" /> <input type="checkbox" name="cb[]" value="1" /> <input type="checkbox" name="cb[]" value="1" /> PHP <?php foreach ($_POST['cb'] as $cb => $val) { // go through them } Link to comment https://forums.phpfreaks.com/topic/198502-php-multiple-choice-quiz-with-answer-count-etc/#findComment-1041696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.