need help to create multiple choice quizz

i need the php code to prepare multiple choice qizz,but it should be using if statement and radio buttons, quiz should be in a single page,simple coding :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

If you get stuck, I’ll help you out…

But you didn’t show us what you have already coded.

i tried his whole day friend,i need to do question posted below…

-*Write a script to ask a user 10 question about PHP, and keep track of their score from question to question
*- Ask one question at a time, and evaluate one answer at a time

  1. Execute the script entirely within one page of code
  2. Include error checking, if the user does not select an answer, report an error and have them redo the question
  3. With your multiple-choice questions, use only ONE VARIBLE NAME to contain all the possible choices.

Show me what you tried…

[php]

01. Which of the following are not considered as Boolean false?





<?php function q2() { print "

01. Which of the following are not considered as Boolean false?





"; } if ( isset($_POST['q1']) ) { switch (@$_POST[q1]) { case "a": print "FAULSE
"; q2(); break; case "b": print "0
"; break; case "c": print "'0'
"; break; case "d": print "'FAULSE'
"; break; default: print "Show all the testimonials we have here."; break; } } if ( isset($_POST['q2']) ) { switch (@$_POST[q2]) { case "a": print "FAULSE
"; break; case "b": print "0
"; break; case "c": print "'0'
"; break; case "d": print "'FAULSE'
"; break; default: print "Show all the testimonials we have here."; break; } } ?> [/php]

This should get you started, but you’ll have to finish it.

[php]

<?php function q1() { print "

01. Which of the following are not considered as Boolean false?

a
b
c
d
"; } function q2() { print "

02. This is question 2?

a
b
c
d
"; } if ( isset($_POST['q1']) ) { switch ($_POST['q1']) { case "a": print "FAULSE
"; break; case "b": print "FAULSE
"; break; case "c": print "Correct
"; break; case "d": print "'FAULSE'
"; break; } q2(); } elseif ( isset($_POST['q2']) ) { switch ($_POST['q2']) { case "a": print "FAULSE
"; break; case "b": print "FAULSE
"; break; case "c": print "Correct
"; break; case "d": print "'FAULSE'
"; } //Call to q3 would go here } else { //Show question one if nothing else matches, that means it's the start of the exam. q1(); } ?> [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service