This repository was archived by the owner on Jul 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseFull.php
More file actions
54 lines (54 loc) · 2.68 KB
/
CourseFull.php
File metadata and controls
54 lines (54 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<form method="GET" action="CourseFull.php">
<!-- SEARCH -------->
<div class="form-group input-group" style="width:300px">
<input type="text" name="courseID" placeholder="กรุณากรอกข้อมูล">
<input type="submit">
</div>
<!-- SEARCH -------->
</form>
<?php
isset($_REQUEST['courseID']) ? $courseID = $_REQUEST['courseID'] : $courseID = '?';
// init
error_reporting(E_ERROR | E_PARSE);
header('Content-Type: text/html; charset=utf-8');
//$curr_code = $_GET['curr_code'];
$curr_code = $courseID;
$xml_string = "http://klogic.kmutnb.ac.th:8080/kris/curri/showXML.jsp?currCode=" . $curr_code;
$xmldata = @file_get_contents($xml_string);
$xml = simplexml_load_string($xmldata); //or die("กรุณากรอกหมายเลขหลักสูตร");
$result = 'curr_code: ' . $curr_code;
if(!$xml){
echo "กรุณากรอกหมายเลขหลักสูตร";
$result = 'No post data yet.';
}
///////////////////////////////////////////////////////////////////////////////////////
else{
echo "<table class='table table-striped table-bordered table-hover'>";
echo " <thead>";
echo " <tr>";
echo " <th width=10%>ลำดับ</th>";
echo " <th width=10%>รหัสวิชา</th>";
echo " <th width=20%>ชื่อวิชาภาษาไทย</th>";
echo " <th width=20%>ชื่อวิชาภาษาอังกฤษ</th>";
echo " <th width=20%>คำอธิบายวิชาภาษาไทย</th>";
echo " <th width=20%>คำอธิบายวิชาภาษาอังกฤษ</th>";
echo " </tr>";
echo " </thead>";
///////////////////////////////////////////////////////////////////////////////////////
$courseCount = $xml->Courses->Course;
$count = null;
for($i=0;$i<count($courseCount);$i++){
//===================================================
$count++;
echo "<tr>";
echo " <td>" . $count . "</td>";
echo " <td>" . $xml->Courses->Course[$i]->attributes() . "</td>";
echo " <td>" . $xml->Courses->Course[$i]->NameThai . "</td>";
echo " <td>" . $xml->Courses->Course[$i]->NameEng . "</td>";
echo " <td>" . $xml->Courses->Course[$i]->DescThai . "</td>";
echo " <td>" . $xml->Courses->Course[$i]->DescEng . "</td>";
echo "</tr>";
}
echo "</table>";
}
?>