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
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
- Execute the script entirely within one page of code
- Include error checking, if the user does not select an answer, report an error and have them redo the question
- 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?
b
c
d
"; } function q2() { print "
02. This is question 2?
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]