01.
<?php
02.
session_start();
03.
include
(
"../config.php"
);
04.
?>
05.
<html>
06.
<head>
07.
<meta charset=
"UTF-8"
>
08.
<title>Local History Southern Thailand </title>
09.
<link rel=
"stylesheet"
href=
"../css/search_edit.css"
>
10.
</head>
11.
<body>
12.
<?php
13.
$key_search
= null;
14.
if
(isset(
$_GET
[
"key_search"
]))
15.
{
16.
$key_search
=
$_GET
[
"key_search"
];
17.
}
18.
?>
19.
<div
class
=
"div1"
>
20.
<h1>ดูแบบทดสอบก่อนเรียน</h1>
21.
</div>
22.
23.
<div
class
=
"div2"
>
24.
<from name=
"f_search"
method=
"GET"
action=
"<?php echo $_SERVER['SCRIPT_NAME'];?>"
>
25.
<input name=
"key_search"
type=
"text"
id=
"key_search"
value=
"<?php echo $key_search;?>"
>
26.
<input type=
"submit"
value=
"search"
class
=
"button"
>
27.
</from>
28.
29.
<?php
30.
31.
$sqli
= "SELECT * FROM pretest a, chapter b, degree c
32.
WHERE a.ct_id = b.ct_id
and
a.dg_id = c.dg_id
and
a.pre_question LIKE
'%".$key_search."%'
";
33.
$result
= mysqli_query(
$con
,
$sqli
)
or
die
(
"Error Query ["
.
$sqli
.
"]"
);
34.
?>
35.
36.
<table id=
"box-table"
>
37.
<tr>
38.
<th>ลำดับ</th>
39.
<th >รหัส</th>
40.
<th >บทเรียน</th>
41.
<th >ระดับ</th>
42.
<th >โจทย์</th>
43.
<th >ตัวเลือกที่1</th>
44.
<th >ตัวเลือกที่2</th>
45.
<th >ตัวเลือกที่3</th>
46.
<th >ตัวเลือกที่4</th>
47.
<th >คำตอบ</th>
48.
<th></th>
49.
<th></th>
50.
</tr>
51.
<?php
52.
$i
=0;
53.
while
(
$row
= mysqli_fetch_array(
$result
,MYSQLI_ASSOC)) {
54.
$i
++;
55.
?>
56.
<tr>
57.
<td ><?php
echo
$i
; ?></td>
58.
<td ><?php
echo
$row
[
"pre_id"
]; ?></td>
59.
<td ><textarea readonly name=
"ct_name"
><?php
echo
$row
[
"ct_name"
] ?></textarea></td>
60.
<td ><textarea readonly name=
"dg_name"
><?php
echo
$row
[
"dg_name"
] ?></textarea></td>
61.
<td ><textarea readonly name=
"quit"
><?php
echo
$row
[
"pre_question"
];?></textarea></td>
62.
<td ><textarea readonly name=
"choice1"
><?php
echo
$row
[
"pre_choice1"
];?></textarea></td>
63.
<td><textarea readonly name=
"choice2"
><?php
echo
$row
[
"pre_choice2"
];?></textarea></td>
64.
<td ><textarea readonly name=
"choice3"
><?php
echo
$row
[
"pre_choice3"
];?></textarea></td>
65.
<td ><textarea readonly name=
"choice4"
><?php
echo
$row
[
"pre_choice4"
];?></textarea></td>
66.
<td ><textarea readonly name=
"answer"
><?php
echo
$row
[
"pre_answer"
];?></textarea></td>
67.
<td ><a href=
"edit_pretest.php?pre_id=<?php echo $row["
pre_id
"]?>"
>แก้ไข</a></td>
68.
<td > <a href =
"delete_pretest.php?pre_id=<?php echo $row["
pre_id
"]?>"
onClick=
'return confirm("คุณแน่ใจ ที่จะลบข้อมูล")'
>ลบ</a></td>
69.
</tr>
70.
<?php
71.
}
72.
?>
73.
</table><br>
74.
<a href=
"../teacher/index_teacher.php"
><input type=
"button"
name=
"button"
value=
"BACK"
class
=
"button2"
></a>
75.
76.
</div>
77.
<br>
78.
<?php mysqli_close(
$con
); ?>
79.
</body>
80.
</html>