|
|
|
ต้องการ Next ข้อสอบที่ละข้อ ค่ะควรทำยังไงค่ะ อยากให้สอบได้ทีละข้อ แล้วเลื่อนไปข้อต่อค่ะ |
|
|
|
|
|
|
|
ไม่ต้องการให้โชว์ทุกข้อแต่ต้องการให้ Next ไปทีละข้อค่ะ
Code (PHP)
<?php require_once('../Connections/MyConnec.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$maxRows_Recordset1 = 11;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_MyConnec, $MyConnec);
$query_Recordset1 = "SELECT * FROM test ORDER BY Rand() ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $MyConnec) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body bgcolor="#FFFACD">
<!--<div align="center"><img src="หัวเว็บ.png" alt="" width="1113" height="203" /></div>-->
<form id="form1" name="form1" method="post" action="get-answer.php">
<input input type ="text" name="St_User" value="<?=$_POST["StuID"];?>">
<input type="hidden" name="StuID" value="<?php
$StuID = $_POST["StuID"];
echo "StuID is $StuID";
?>">
<p>
<?php
$chNum=1;
do {
?>
<br/>
<?php echo $chNum; ?>)<?php echo $row_Recordset1['T_question']; ?><br/>
<br/>
<input type="radio" name="<?php echo $row_Recordset1['T_id']; ?>" id="T_c1" value="1" />
<?php echo $row_Recordset1['T_c1']; ?><br />
<input type="radio" name="<?php echo $row_Recordset1['T_id']; ?>" id="T_c2" value="2" />
<?php echo $row_Recordset1['T_c2']; ?><br />
<input type="radio" name="<?php echo $row_Recordset1['T_id']; ?>" id="T_c3" value="3" />
<?php echo $row_Recordset1['T_c3']; ?><br />
<input type="radio" name="<?php echo $row_Recordset1['T_id']; ?>" id="T_c4" value="4" />
<?php echo $row_Recordset1['T_c4']; ?><br/>
<?php
$chNum++;
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</p>
<p>
<input type="submit" name="button" id="button" value="ตกลง" />
<br />
</p>
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2017-03-24 10:59:34 |
By :
Tarnikar |
View :
693 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นี่ใช่น้องนักเลงคีย์บอร์ดหรือเปล่าคะ
|
|
|
|
|
Date :
2017-03-25 00:45:28 |
By :
mintracss019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|