Jump to content

php multiple choice quiz with answer count etc


nade93

Recommended Posts

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!

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
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.