I am a bit new to php and I need to create a quiz website. I have been searching a lot but I couldn’t find the exact code that I need.
On the first page, the user will see questions, answers and he can choose answers by clicking radio buttons. Once submitted, I want to compare on the next page 2 arrays of answers (user answers and the correct answers).
The correct answers array may look like this:
$res1 = array(b,a,b,c,b,d,a,b,c,b);
I believe I should use “for” or “for each” but I don’t know how to write it.
The next step will be incrementing the quiz score in case the compared values are equal (user choice: b and correct answer: b)
Here is a simple solution for you:
First, create a form like this:
In php, do something like this: