01.
<script type=
"text/javascript"
>
02.
function
check(e){
03.
if
(e.checked == true) {
04.
document.getElementById(
'UserID_teacher[]'
).disabled=false;
05.
}
else
{
06.
document.getElementById(
'UserID_teacher[]'
).disabled=true;
07.
}
08.
}
09.
</script>
10.
11.
....
12.
13.
14.
<table width=
"26%"
class
=
"table table-striped table-bordered table-hover"
>
15.
<thead>
16.
<tr>
17.
<th width=
"17%"
>รหัสรายวิชา</th>
18.
<th width=
"33%"
>ชื่อรายวิชา</th>
19.
<th width=
"17%"
>ประจำชั้น</th>
20.
<th width=
"12%"
></th>
21.
<th width=
"21%"
></th>
22.
23.
</tr>
24.
</thead>
25.
<tbody>
26.
27.
28.
<?php
29.
if
(
$_GET
[
"item"
] !=
""
)
30.
{
31.
$strSQL
= "SELECT distinct course.course_id, course.course_name, class_student.Class_name FROM course, class_student
32.
WHERE course.Class_ID=
'".$_GET["item"]."'
33.
AND course.Class_ID=class_student.Class_ID";
34.
$objQuery
= mysql_query(
$strSQL
);
35.
$item
=
$_GET
[
"item"
];
36.
while
(
$row
= mysql_fetch_array(
$objQuery
)){
37.
echo
"<tr><td>"
.
$row
[
'course_id'
] ."</td>
38.
<td>
". $row['course_name'] ."
</td>
39.
<td>
". $row['Class_name'] ."
</td>
40.
<td><center><input type=
'checkbox'
id=
'course_id[]'
name=
'course_id[]'
value=
'". $row['
course_id
'] ."'
onClick=
'check(this)'
/></center></td>
41.
<td><select
class
=
'form-control'
id=
'UserID_teacher[]'
name=
'UserID_teacher[]'
value=
". $row1['UserID_teacher']."
><option>-- กรุณาเลือก --</option>";
42.
43.
$sql
= mysql_query(
"SELECT * FROM member_teacher"
);
44.
while
(
$row1
= mysql_fetch_array(
$sql
)){
45.
echo
"<option id='UserID_teacher[]' name='UserID_teacher' value="
.
$row1
[
'UserID_teacher'
].
">"
.
$row1
[
'TeacherName'
] .
"</option>"
;
46.
}
47.
48.
echo
"</select></td></tr>"
;
49.
}
50.
}
51.
52.
?>
53.
54.
55.
<tr><td colspan=
"5"
><div align=
"center"
>
56.
57.
<button type=
"button"
class
=
"btn btn-primary"
onClick=
"history.back();"
>Back Button</button>
58.
<button type=
"submit"
class
=
"btn btn-primary"
>Save Button</button>
59.
60.
</div></td></tr>
61.
</tbody>
62.
</table>