001.
<?php
002.
session_start();
003.
?>
004.
<!doctype html>
005.
<html lang=
"en"
>
006.
<head>
007.
<!
008.
<meta charset=
"utf-8"
>
009.
<meta
name
=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
012.
013.
<!
016.
<!
018.
<link rel=
"stylesheet"
href=
"../css/bgcover.css"
>
019.
<link rel=
"stylesheet"
href=
"../css/contentindex.css"
>
020.
<link rel=
"stylesheet"
href=
"../css/datatables.css"
>
021.
<link rel=
"stylesheet"
href=
"../css/fontbg.css"
>
022.
<title>เว็บไซต์ศูนย์ข้อมูลเพื่อเรียนรู้คุณค่าของสมุนไพรไทย</title>
023.
</head>
024.
<body>
025.
<nav class=
"navbar navbar-expand-lg navbar navbar-dark "
style=
"background-color: #000000;"
>
026.
<button class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
027.
<span class=
"navbar-toggler-icon"
></span>
028.
</button>
029.
030.
<div class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
031.
<ul class=
"navbar-nav mr-auto"
>
032.
<li class=
"nav-item"
>
033.
<a class=
"nav-link"
href=
"index.php"
>หน้าหลัก </a>
034.
</li>
035.
<li class=
"nav-item active"
>
036.
<a class=
"nav-link"
href=
"admin_herb-info.php"
>จัดการข้อมูลสมุนไพร </a>
037.
</li>
038.
<li class=
"nav-item"
>
039.
<a class=
"nav-link"
href=
"admin_relief-herbal.php"
>จัดการอาการที่ใช้สมุนไพรในการบรรเทา</a>
040.
</li>
041.
<li class=
"nav-item"
>
042.
<a class=
"nav-link"
href=
"admin_blog.php"
>จัดการบทความ</a>
043.
</li>
044.
</ul>
045.
<ul class=
"navbar-nav ml-auto"
>
046.
<li class=
"nav-item"
>
047.
<a class=
"nav-link"
href=
"../php/logout.php"
>ออกจากระบบ</a>
048.
</li>
049.
</ul>
050.
</div>
051.
</nav>
052.
<
section
class=
"bgimage"
>
053.
<div class=
"container-fluid"
>
054.
<div class=
"row"
>
055.
<div class=
"col-lg-12 col-md-12 col-sm-12 col-xs-12"
>
056.
<h1 class=
"font"
style=
"font-size: 60px;"
>เว็บไซต์ศูนย์ข้อมูลเพื่อเรียนรู้คุณค่าของสมุนไพรไทย</h1>
057.
</div>
058.
</div>
059.
<p class=
"fontbg"
style=
"text-align:right;color:white;margin-top:165px;opacity:0.5;"
> รูปภาพโดย : Tim Chow </p>
060.
</div>
061.
</
section
>
062.
<!
063.
<div class=
"container"
id=
"contentindex"
>
064.
<div class=
"row"
>
065.
<div class=
"col-sm-4"
>
066.
067.
</div>
068.
<div class=
"col-sm-4"
style=
"text-align: center;margin-top: 50px;margin-bottom:30px;"
>
069.
<h1>ข้อมูลสมุนไพร</h1>
070.
071.
</div>
072.
<div class=
"col-sm-4"
>
073.
074.
</div>
075.
</div>
076.
</div>
077.
078.
<!
079.
080.
<div class=
"container"
>
081.
<div class=
"row col-md-12 "
>
082.
<
table
class=
"table table-hover"
id=
"filterme"
>
083.
<thead>
084.
085.
086.
<!
087.
<?php
088.
require
'../php/condb.php'
;
089.
$perpage = 10;
090.
if (isset($_GET[
'page'
])) {
091.
$page = $_GET[
'page'
];
092.
}
else
{
093.
$page = 1;
094.
}
095.
if (isset($_POST[
'search'
])) {
096.
$search =
'%'
. $_POST[
'search'
] .
'%'
;
097.
}
else
{
098.
$search =
'%'
;
099.
}
100.
$start = ($page - 1) * $perpage;
101.
//search //
102.
$sql =
"SELECT herbal.*,herb_howto.herb_howto_id FROM herbal,herb_howto WHERE herb_name LIKE '$search' ORDER BY `herb_name` ASC LIMIT {$start} , {$perpage} "
;
103.
$result1 = mysqli_query($condb, $sql);
104.
?>
105.
<!
106.
<div class=
"container"
>
107.
<div class=
"row"
>
108.
<div class=
"col-sm-3"
><a href=
"form_herb-info.php"
class=
"btn btn-primary btn-xs pull-right"
style=
"margin-bottom: 30px"
><b>+</b> เพิ่มข้อมูลสมุนไพร</a></div>
109.
<div class=
"col-sm-4"
></div>
110.
<div class=
"col-sm-5"
>
111.
<div class=
"input-group input-group-sm mb-3"
>
112.
<form
action
=
"admin_herb-info.php?page=<?php echo $page;?>"
method=
"post"
>
113.
<input class=
"form-control "
type=
"text"
name
=
"search"
placeholder=
"Search"
aria-label=
"Search"
></input>
114.
<div class=
"input-group-append"
>
115.
<button type=
"submit"
class=
"btn btn-primary"
>ค้นหาข้อมูล</button>
116.
</div>
117.
</div>
118.
</div>
119.
</div>
120.
</div>
121.
<!
122.
123.
124.
<tr>
125.
<th class=
"text-center"
style=
"font-size:20px"
>#</th>
126.
<th class=
"text-center"
style=
"font-size:20px"
>ชื่อสมุนไพร</th>
127.
<th class=
"text-center"
style=
"font-size:20px"
>
Option
</th>
128.
</tr>
129.
</thead>
130.
131.
<tbody>
132.
<!
133.
134.
135.
<?php
136.
while ($row = mysqli_fetch_array($result1, MYSQLI_ASSOC)) {
137.
138.
139.
?>
140.
<tr>
141.
<th class=
"text-center"
style=
"font-size:20px"
> <?php echo $row[
'herbal_id'
];?> </th>
142.
<td class=
"text-center"
style=
"font-size:20px"
> <?php echo $row[
'herb_name'
]; ?> </td>
143.
<td class=
"text-center"
style=
"font-size:20px"
><a style=
"margin-right:15px;"
class=
'btn btn-outline-primary btn-sm'
href=
"edit_form_herb-info.php?herbal_id=<?php echo $row['herbal_id'];?>&&herb_howto_id=<?php echo $row['herb_howto_id'];?>"
><span class=
"glyphicon glyphicon-edit"
></span> แก้ไข</a><a href=
"../php/del_herb-info.php?herbal_id=<?php echo $row['herbal_id'];?>"
class=
"btn btn-outline-danger btn-sm"
><span class=
"glyphicon glyphicon-remove"
></span> ลบ</a></td>
144.
145.
</tr>
146.
<?php
147.
}
148.
mysqli_free_result($result1);
149.
mysqli_close($condb);
150.
?>
151.
</tbody>
152.
153.
</
table
>
154.
</div>
155.
</div>
156.
<!
157.
<?php
158.
require
'../php/condb.php'
;
159.
$sql2 =
"select * from herbal WHERE herb_name LIKE '$search'"
;
160.
$result2 = mysqli_query($condb, $sql2);
161.
$total_record = mysqli_num_rows($result2);
162.
$total_page = ceil($total_record / $perpage);
163.
?>
164.
<!
165.
<!
166.
<nav aria-label=
"Page navigation example"
>
167.
<ul class=
"pagination justify-content-center"
>
168.
<li class=
"page-item"
>
169.
<a class=
"page-link"
href=
"admin_herb-info.php?page=1"
tabindex=
"-1"
>Previous</a>
170.
</li>
171.
<?php
for
($i=1;$i<=$total_page;$i++){ ?>
172.
<li class=
"page-item"
>
173.
<a class=
"page-link"
href=
"admin_herb-info.php?page=<?php echo $i; ?>"
><?php echo $i; ?></a>
174.
</li>
175.
<?php } ?>
176.
<li class=
"page-item"
>
177.
<a class=
"page-link"
href=
"admin_herb-info.php?page=<?php echo $total_page;?>"
>
Next
</a>
178.
</li>
179.
</ul>
180.
</nav>
181.
182.
<footer class=
"page-footer font-small stylish-color-dark pt-4 mt-4"
>
183.
<!
184.
<div class=
"footer-copyright text-center py-3"
></a>
185.
</div>
186.
<!
187.
</footer>
188.
189.
190.
191.
192.
<!
193.
<!
197.
</body>
198.
</html>