Retrieve saved data from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shradha Vyas
    New Member
    • Oct 2011
    • 1

    #1

    Retrieve saved data from database

    i have a project for online exam where we are providing tests in the following format
    PAGE1
    ---------------
    1.QUESTION
    a.ans1
    b.ans2
    c.ans3
    d.ans4
    NEXT
    ------------------
    on clicking the button "NEXT" it jumps to a second page with 2.QUESTION.i am not able to fetch the answer selected by the user to the user to PAGE 2 to calculate the score and display as YOUR SCORE: 0 OR 1
    our work environment is ubuntu.
    we are using PHP,and oracle database


    my respective coding:
    Code:
    <html>
    <head>
    <title>Que1</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="rghtstyle.css" />
    
    
    </head>
    <body>
          <div id="container">
                    <div id="header">
                            <h1><font size="22">HTN<span class="off">bench</span></font></h1>
                            <h2></h2>
            </div>
    
    <form action="c2.php" method="post">
    <?php
    include('/usr/share/moodle/lib/adodb/adodb.inc.php');
    function InvokeErrorHandler(){
    global $db; ## assume global 
            print_r($db->ErrorNo());
            print_r($db->ErrorMsg());
    print_r("PHP to ORCALE error");
    }
    $db = NewADOConnection("oci8");
    if(!$db->connect('192.168.0.1:1521','htnbench','induzhtn','orcl')) InvokeErrorHandler();
    $rs =$db->Execute("select * from clang where quesno=1");
    ?>
    <?php
    while(!$rs->EOF){
    print_r($rs->fields[0].' '.$rs->fields[1].'<br>' );?>
    <?php 
    $a=$rs->fields[2];
    $b= $rs->fields[3];
    $c=$rs->fields[4];
    $d=$rs->fields[5];
    ?>
    <p>
            <input type="radio" name="ans" value=""/> <?php print_r($a.'<br>' ); ?>
    <p>
            <input type="radio" name="ans" value=""/> <?php print_r($b.'<br>' ); ?>
    <p>
            <input type="radio" name="ans" value=""/> <?php print_r($c.'<br>' ); ?>
    <p>
            <input type="radio" name="ans" value=""/> <?php print_r($d.'<br>' ); ?>
    
    <?php
    $rs->MoveNext();
    echo "<hr>";
    }?>
    <center><input name="" type="submit" value="Next" /></center>
    </form>
    </body>
    </html>
    Last edited by Niheel; Oct 12 '11, 08:11 AM. Reason: use code tags, watch spelling mistakes "plz,plz,plz"
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Your radio buttons have no values so it's not going to pass anything.

    Comment

    • freefony
      New Member
      • Nov 2008
      • 59

      #3
      onselect of the answer is the form submitted if so u can collect the option selected to a table that relates questions to option the user selected before u load the new question

      Comment

      Working...