|
|
|
การทำcheck box ให้ผันไปตามตารางที่ต้องการโดยที่เราสามารถเลือก Check box ตามที่ต้องการตารางก็จะผันไปตามตาราง |
|
|
|
|
|
|
|
Code (PHP)
<?php session_start();?>
<?php require_once('../connection/connect.php'); ?>
<?php require_once('../connection/function.php'); ?>
<?php require_once('../connection/session.php'); ?>
<html><!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Examination Online System</title>
<style type="text/css">
body
{
margin:auto auto auto auto;
}
#left
{
position:fixed;
right:-2px;
width:202px;
}
#right
{
position:fixed;
float:right;
width:770px;
}
.cbg table tr td table tr td #right form table tr td {
text-align: left;
}
</style>
<!-- InstanceEndEditable -->
<meta name="description" content="Education website">
<meta name="keywords" content="education, learning, teaching">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListCourse(SelectValue)
{
frmMain.ddlCourse.length = 0
frmMain.ddlChapter.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlCourse.options[frmMain.ddlCourse.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM courses ORDER BY courseId ASC ";
//SELECT * FROM tb_subtype ORDER BY id_subtype ASC
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$objResult["facultyId"];?>";
strValue = "<?=$objResult["courseId"];?>";
strItem = "<?=$objResult["courseName"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlCourse.options[frmMain.ddlCourse.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***//
//**** List Amphur (Start) ***//
function ListChapter(SelectValue)
{
frmMain.ddlChapter.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlChapter.options[frmMain.ddlChapter.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM chapters ORDER BY chapterId ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = "<?=$objResult["courseId"];?>";
strValue = "<?=$objResult["chapterId"];?>";
strItem = "<?=$objResult["chapterName"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlChapter.options[frmMain.ddlChapter.length]= myOption
}
<?
}
?>
}
//**** List Amphur (End) ***//
</script>
</head>
<body>
<table width="765" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../images/t1.gif" width="335" height="237"></td>
<td><table width="105%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../images/t2.gif" width="354" height="37"></td>
</tr>
<tr>
<td><img src="../images/t2-5.gif" width="354" height="200"></td>
</tr>
</table></td>
<td><img src="../images/t3.gif" width="330" height="237"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="../images/ml.gif" width="7" height="35"></td>
<td background="../images/mbg.gif" class="bgx"><table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="menu"><a href="#">About Us</a></td>
<td width="1"><img src="../images/msep.gif" width="5" height="35"></td>
<td class="menu"><a href="#">Student Life</a></td>
<td width="1"><img src="../images/msep.gif" width="5" height="35"></td>
<td class="menu"><a href="#">Contact Details</a></td>
</tr>
</table></td>
<td width="1"><img src="../images/mr.gif" width="8" height="35"></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="27" background="../images/cbgl.gif" class="bgy"><img src="../images/cbgl.gif" width="7" height="1"></td>
<td width="1149" class="cbg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="100%" valign="top"> </td>
<td width="991" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><!-- InstanceBeginEditable name="EditRegion3" -->
<!-- right form -->
<div id="right">
<script language = "JavaScript">
function Listlevel(SelectValue)
{
form1.level.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('เลือก','')
form1.level.options[form1.level.length]= myOption
<?
$intRows = 0;
$sql = "SELECT * from quiz_banks where
quiz_type = 'Describe' or
quiz_type = 'Single Choose' or
quiz_type = 'TF'or
quiz_type = 'Multiple Choose' ";
$result = mysql_query($sql) or die ("Error Query [".$sql."]");
$intRows = 0;
while($row = mysql_fetch_array($result))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = '<?=$row["quiz_type"];?>';
strValue = "<?=$row[""];?>";
strItem = "<?=$row[""];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
form1.level.options[form1.level.length]= myOption
}
<?
}
?>
}
</script>
<form name="form1" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<option id="level" name="level" onChange = "ListChapter(this.value)">
<?php
$sql = "SELECT * from quiz_banks where
quiz_type = 'Describe' or
quiz_type = 'Single Choose' or
quiz_type = 'TF'or
quiz_type = 'Multiple Choose' ";
$result = mysql_query($sql) or die ("Error Query [".$sql."]");
while($row = mysql_fetch_array($result))
{
?>
<?
}
?>
</select>
<table width="100%" height="123" border="1">
<tr>
<td width="24%"> </td>
<td width="12%"> </td>
<td width="13%"> </td>
<td width="5%"> </td>
<td width="13%"> </td>
<td width="5%"> </td>
<td width="13%"> </td>
<td width="5%"> </td>
<td width="10%"> </td>
</tr>
<tr>
<td>ประเภทสข้อสอบ : </td>
<td colspan="8"> </td>
</tr>
<tr>
<td colspan="9"><table width="100%" border="1">
<tr>
<td width="17%"> </td>
<td width="4%"><input type="checkbox" name="Single Choose" id="Single Choose" value="Single Choose" ></td>
<td width="38%">ข้อสอบตัวเลือกข้อเดียว</td>
<td width="4%"><input type="checkbox" name="Multiple Choose" id="Multiple Choose" value="Multiple Choose" ></td>
<td width="37%">ข้อสอบตัวเลือกหลายข้อ</td>
</tr>
<tr>
<td> </td>
<td><input type="checkbox" name="TF" id="TF" value="TF" ></td>
<td>ข้อสอบตัวเลือกถูกผิด</td>
<td><input type="checkbox" name="Describe" id="Describe" value="Describe" ></td>
<td>ข้อสอบประเภทเติมคำ</td>
</tr>
</table></td>
</tr>
<tr>
<td>ระดับความยากง่ายของข้อสอบ</td>
<td><select name="level" id="level">
<option value="-">เลือก</option>
<option value="e">ง่าย</option>
<option value="m">กลาง</option>
<option value="h">ยาก</option>
<?php
$sql = "select * from quiz_banks order by qid asc";
$query = mysql_query ($sql) or die (mysql_error() );
$num = mysql_num_rows ($query);
for ($i=1;$i<=$num;$i++)
{
$row = mysql_fetch_array ($query); // fetch array
?>
<?php
}
?>
</select></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><input type="submit" name="button2" id="button2" value="Submit"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="40"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<?
$course = $_GET["course"];
$chapter= $_GET["chapter"];
$type = $_GET["quiz_type"];
$level = $_GET["level"];
if($level=="-") {$level="%";}
// Search By Name or Email
$sql = "SELECT * FROM quiz_banks where courseId = '$course' and chapterId = '$chapter' and quiz_type like '$type' and level like '$level' ";
$result = mysql_query($sql) or exit($sql);
$Num_Rows = mysql_num_rows($result);
?>
<table width="100%" border="1">
<tr>
<td>ลำดับข้อ</td>
<td>ข้อสอบ</td>
<td>ประเภท</td>
<td>ระดับ</td>
<td>อนุมัติ</td>
</tr>
<?
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="6%"> </td>
<td width="26%"> </td>
<td width="17%"> </td>
<td width="17%"> </td>
<td width="17%"><input type="checkbox" name="checkbox5" id="checkbox5">check-all</td>
</tr>
<tr>
<td><?php echo $row['qid']?></td>
<td><?php echo $row ['question_text']?></td>
<td><?php echo $row['quiz_type']?></td>
<td><?php if($row["level"]=="e"){echo "easy";}
else if($row["level"]=="m"){echo "medium";}
else if($row["level"]=="h"){echo "hard";}
?>
<td><input type="checkbox" name="checkbox6" id="checkbox6"></td>
</tr>
<?php } ?>
</table>
<p>
<input type="submit" name="button" id="button" value="Submit">
</p>
</form>
</div>
<!-- left form -->
<div id=left>
</div>
<!-- InstanceEndEditable --></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="8" background="../images/cbgr.gif" class="bgy"><img src="../images/cbgr.gif" width="8" height="1"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="../images/bml.gif" width="7" height="24"></td>
<td width="100%" bgcolor="#0C5282" class="bottom-menu">Copyright © 2010 School of Information Technology, King Mongkut's University of Technology Thonburi.</td>
<td><img src="../images/bmr.gif" width="8" height="24"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1" bgcolor="#1A658C" class="bottom_addr"> </td>
</tr>
</table>
<p> </p>
<div style="position:absolute;left:-30000px;top:-30000px"><a href="http://anvisionwebtemplates.com">Website templates</a><a href="http://cityants.co.uk">Business directory UK</a><a href="http://cityants.net">Yellow pages US</a><a href="http://anvisionwebdesign.com">Website design company</a><a href="http://webdesignfinders.net">Web design directory</a><a href="http://australia.webdesignfinders.net">Web design directory Australia</a><a href="http://canada.webdesignfinders.net">Web design directory Canada</a><a href="http://anvisionwebtemplates.com/free-education-web-templates-layouts.html">Free education web templates</a></div>
</body>
<!-- InstanceEnd --></html>
เพิ่มเติมค่ะ
|
|
|
|
|
Date :
2010-09-09 14:01:22 |
By :
pandakuku |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|