Mini Shell
<?php
include 'head.php';
if ($s_status_user == 3) {
header("Location: login.php");
}
?>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<script language="javascript">
window.onload = function () {
var a=document.getElementById('mytable'); // อ้างอิงตารางด้วยตัวแปร a
for(i=0;i<a.rows.length;i++){ // วน Loop นับจำนวนแถวในตาราง
if(i>0){ // ตรวจสอบถ้าไม่ใช่แถวหัวข้อ
if(i%2==1){ // ตรวจสอบถ้าไม่ใช่แถวรายละเอียด
a.rows[i].className=""; // กำหนด class แถวแรก
}else{
a.rows[i].className="info"; // กำหนด class แถวที่สอง
}
}else{ // ถ้าเป็นแถวหัวข้อกำหนด class
a.rows[i].className="active";
}
}
}
</script>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS | skin-blue |
| | skin-black |
| | skin-purple |
| | skin-yellow |
| | skin-red |
| | skin-green |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed |
| | layout-boxed |
| | layout-top-nav |
| | sidebar-collapse |
| | sidebar-mini |
|---------------------------------------------------------|
-->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- Main Header -->
<?php include 'header.php'; ?>
<!-- Left side column. contains the logo and sidebar -->
<?php include 'leftside.php'; ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
คำนำหน้าชื่อ
<small>จัดการข้อมูลคำนำหน้าชื่อ</small>
</h1>
<ol class="breadcrumb">
<li><a href="index.php"><i class="fa fa-dashboard"></i> เมนูหลัก</a></li>
<li class="active">คำนำหน้าชื่อ</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<!-- Your Page Content Here -->
<a href="frm_tn.php" class="btn btn-primary"><i class="fa fa-plus"></i> เพิ่มรายการ</a>
<br><br>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">ข้อมูลคำนำหน้าชื่อ</h3>
<div class="box-tools pull-right">
<!-- Buttons, labels, and many other things can be placed here! -->
<!-- Here is a label for example -->
<?php
$sql_tn = "SELECT COUNT(*) AS COUNTTN FROM title_name";
$result_tn = mysqli_query($link, $sql_tn);
$count_tn = mysqli_fetch_assoc($result_tn);
?>
<h4><span class="label label-primary">ทั้งหมด <?php echo $count_tn['COUNTTN'];?> รายการ</span></h4>
</div><!-- /.box-tools -->
</div><!-- /.box-header -->
<div class="box-body">
<?php
$sql = "SELECT * FROM title_name ORDER BY titleID ASC";
$result = mysqli_query($link, $sql);
?>
<table id="mytable" class="table table-hover">
<tr>
<th style="text-align: center;">รหัส</th>
<th>คำนำหน้า</th>
<th style="text-align: center;" >ลบ</th>
</tr>
<?php while ($row = mysqli_fetch_row($result)) { ?>
<tr>
<td style="text-align: center;"><?= $row[0] ?></td>
<td><?= $row[1] ?></td>
<td style="text-align: center;"> <a href="member.php?id="<?= $row[0]; ?>" class="btn btn-danger btn-xs btn_del" title="ลบข้อมูล"><i class="fa fa-times"></i></a></td>
</tr>
<?php } ?>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Main Footer -->
<?php include 'footer.php'; ?>
</div>
<!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="bootstrap/js/sweetalert.min.js"></script>
<script src="bootstrap/js/smoke.min.js"></script>
<script>
$(document).ready(function(){
$(".btn_del").on("click",function(e) {
//delete confirm
var row_id = $(this).attr('id');
swal({
title: "คุณแน่ใจหรือไม่ว่าต้องการลบข้อมูล?",
text: "คุณจะไม่สามารถกู้คืนข้อมูลนี้ได้อีก!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#d33',
confirmButtonText: "ตกลง, ลบข้อมูล!",
cancelButtonText: "ยกเลิก..",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
window.location.replace('del_tn.php?id='+row_id); //redirect to your url
} else {
swal("ยกเลิก", "ข้อมูลของคุณยังไม่ถูกลบ :)", "error");
}
});
e.preventDefault();
});
});
</script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
Both of these plugins are recommended to enhance the
user experience. Slimscroll is required when using the
fixed layout. -->
</body>
</html>
Zerion Mini Shell 1.0