There is a php test.
I do this: by default, the php handler has two variables - $ ot and $ not - right and wrong answers, initially set them to 0, I raise $ ok by 1 for the right answer, and I raise by $ not for the wrong answer.
code example:
<?php $ot = 0; $not = 0; if ($_POST[q1] == a){$ot++;} else {$not++;} if ($_POST[q2] == a){$ot++;} else {$not++;} ?> There are no problems with radio buttons, only one option. But in questions with the checkbox I can not verify the correctness of the selected answers.
Tell me how to implement this in my example.
Here is the html code
<div> <p>1. ВОПРОС 1...</p> <input name="q1[]" type="checkbox" value="a"> 1</label><br> <input name="q1[]" type="checkbox" value="b"> 2</label><br> <input name="q1[]" type="checkbox" value="c"> 3</label><br> </div> And here is a part of my php code
<?php $ot = 0; $not = 0; $q1 = POST_['q1']; foreach($q1 as $value) { .... } ?> That's what to put in place ... I can not understand. The correct answer is 1 and 3 checkboxes, for example.