测试下一个和上一个按钮

时间:2019-02-15 13:00:30

标签: javascript php html function cbt

我正在创建在线测试/考试 国家。问题在于下一个和上一个按钮仅重复一次。 当我点击按钮时,它只会重复一次 我将不同的功能称为pprev和next按钮

<!DOCTYPE HTML>
<HTML>
<Head>
  <title>Examination Application</title>

  <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
 <link href="style.css" rel="stylesheet">



 </head>

<script src="jquery/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
  <body>
<?Php
$currentquestion = 1;
 $GLOBALS['currentquestion'];

 //function  showque
Function showquestion(){
// CONFIGURATION
require("db.php");

$sql = "Select * from questions";
$query =$conn->query($sql);
$array = array();

while($row = $query->fetch_assoc()){
 $array[]=$row;

}
global $currentquestion;

 echo '<form name="myform" method="GET" action="quiz.php">';
echo "<table width=100%> <tr> <td width=30>&nbsp;<td> <table border=0>";
echo $array[$currentquestion]['ques'];
echo '<br/>';
echo '<tr><td class=style8><input type="radio" name="ans" id="checkbox" 
value=1>'; echo $array[$currentquestion]['OPTION_A'];
echo '<br/>';
echo '<tr><td class=style8><input type=radio name="ans" id="checkbox1" value=2>'; echo $array[$currentquestion]['OPTION_B'];

echo '<br/>';
echo '<tr><td class=style8><input type=radio name="ans" id="checkbox2" value=3>'; echo $array[$currentquestion]['OPTION_C'];
echo '<br/>';
echo'<tr><td class=style8><input type=radio name="ans" id="checkbox3" value=4>';echo  $array[$currentquestion]['OPTION_D'];
echo '<br/>';
echo "<tr><td><input type=submit name=submit value='Next Question'>";
echo "<tr><td><input type=submit class='float-right' name=submit value='Previous Question'>";
echo "<tr><td><input type=submit name=submit value='Get Result'>";
echo '</table></form>';
}

Function nextquestion(){
    global  $currentquestion;
  str_repeat( $currentquestion++,13);
    showquestion();
}
Function prevquestion(){
    global  $currentquestion;
     $currentquestion--;
    showquestion();

}

if(!isset($POST['submit'])){

    if($submit =$_GET['submit']){
    echo $submit;
if($submit=='Next Question' )
        {
                nextquestion();
        }

        if($submit=='Previous Question' )
        {
                prevquestion();
        }}else{
            showquestion();
        }
    }

问题是下一个和上一个按钮仅重复一次 当我单击按钮时,它只会重复一次

0 个答案:

没有答案