viewquestionpapercomplete.php

来自「一个基于PHP的在线考试系统」· PHP 代码 · 共 73 行

PHP
73
字号
<html>
<head>
<title>Question</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">

<?PHP
include('config.inc');


//debug
$maxquestion=19;
$questionpaperid=100;




$db_connect = mysql_connect($datahost,$datauser,$datapasswd);
$base_selection = mysql_select_db($base,$db_connect);

for ($qid = 0; $qid <= $maxquestion; $qid++) {


$questionnumber="q".$qid;



$query1 =  "SELECT ".$questionnumber." FROM questionpapers where questionpaperid ='$questionpaperid'";

$req1 = mysql_query($query1);

while($row = mysql_fetch_object ($req1)){
$questionid=$row->$questionnumber;       	
// echo $questionid."  ".$answer;
           }
mysql_free_result($req1);

$query =  "SELECT * FROM questionbank where questionid ='$questionid'";
$req = mysql_query($query);

//echo "<form name=\"form1\" method=\"post\" action=\"$phpself\">";
 while($row = mysql_fetch_array($req))
            {
$questionid=$row['questionid'];
$question=$row['question'];
$choice1=$row['choice1'];
$choice2=$row['choice2'];
$choice3=$row['choice3'];
$choice4=$row['choice4'];
echo "<table width=\"75%\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\">\n";
echo "<tr><td colspan=4><b> ".$qid.". </b> ".$question."</td></tr>\n <input type=\"hidden\" name=\"qid\" value=\"$qid\">";      // <input type=\"hidden\" name=\"questionid\" value=\"$questionid\">
echo "<tr><td width=\"25%\">".$choice1."</td><td width=\"25%\">".$choice2."</td><td width=\"25%\">".$choice3."</td><td width=\"25%\">".$choice4."</td></tr>\n";

//Debug
//echo "<tr><td width=\"5%\"><input type=\"radio\" name=\"answer\" value=\"1\"></td><td width=\"20%\">".$choice1."</td><td width=\"5%\"><input type=\"radio\" name=\"answer\" value=\"2\"></td><td width=\"20%\">".$choice2."</td><td width=\"5%\"><input type=\"radio\" name=\"answer\" value=\"3\"></td><td width=\"20%\">".$choice3."</td><td width=\"5%\"><input type=\"radio\" name=\"answer\" value=\"4\"></td><td width=\"20%\">".$choice4."</td></tr>\n";

echo "</table>\n";
echo "<br>\n";
 

    }
mysql_free_result($req);

//Debug
//echo "<br><input type=\"submit\" name=\"Submit Answers\" value=\"Submit\"><input type=\"reset\" name=\"reset\" value=\"Reset\">";
//echo "</form><br>\n";
}

?>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?