Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Thanked 0 Times in 0 Posts

    online quiz query

    I am at the first stage of creating a quiz.
    I wish to know is it possible to click a button to proceed to the next question, with questions to be asked using for/while loop

    I want to use

    1. php as scripting language.
    2. Mysql as database.
    3. For each correct answer there should be increment of 1 in score.
    4. all questions are multiple choice questions.

    I have writen a code but its not working properly,which is given below
    If u can suggest something it would be a great help

    Thanks in advance

    code which i have written is:-

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>



    $host="localhost"; // Host name
    $username="root"; // Mysql username
    //$password=""; // Mysql password
    $db_name="rounds"; // Database name
    $tbl_name="round1"; // Table name

    // Connect to server and select databse.
    mysql_connect("$host", "$username")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
    $sql="SELECT id,question,a,b,c,d,ans FROM $tbl_name";


    echo " ".mysql_result($res,$i,0);
    echo " ".mysql_result($res,$i,1).'<br/>';

    <form method="get" >
    <input type="radio" name="RadioGroup1" value="<?php echo " ".mysql_result($res,$i,2);?>" />
    <?php echo " ".mysql_result($res,$i,2);?></label>
    <input type="radio" name="RadioGroup1" value="radio" />
    <?php echo " ".mysql_result($res,$i,3);?></label>
    <input type="radio" name="RadioGroup1" value="radio" />
    <?php echo " ".mysql_result($res,$i,4);?></label>
    <input type="radio" name="RadioGroup1" value="radio" />
    <?php echo " ".mysql_result($res,$i,5);?></label>
    if (isset($_POST['RadioGroup1'])) {
    $selected_radio = $_POST['RadioGroup1'];
    print $selected_radio;


    <form id="form1" name="form1" method="post" >
    <input type="submit" name="Submit" value="Finish" />

    echo "$score";


  2. #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Thanked 637 Times in 625 Posts

  3. Users who have thanked Fumigator for this post:

    swati soni (09-15-2009)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts