| Server IP : 104.21.80.248 / Your IP : 172.71.28.155 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/www/news/elearning/admin/ |
Upload File : |
<?php
require '../configs/app_top.php';
if(!is_admin_logged_in()) { redirect(generate_admin_link("login")); exit;}
if ($_GET["mode"] == "add") {
$title = "เพิ่มหมวดหมู่";
} else {
$title = "Edit Category";
try {
$sql2 = "select `ct_id`, `ct_name`, `active` "
. "FROM " . TBL_CATEGORY . " WHERE 1 AND ct_id = :id LIMIT 1";
$stmt = $DB->prepare($sql2);
$stmt->bindValue(":id", safe_input($_GET["id"]));
$stmt->execute();
$results = $stmt->fetchAll();
} catch (Exception $ex) {
echo $ex->getMessage();
}
}
include './includes/header.php';
?>
<?php if ($ERROR_TYPE <> "") { ?>
<div class="col-12">
<div class="alert alert-<?php echo $ERROR_TYPE; ?>">
<button data-dismiss="alert" class="close" type="button">×</button>
<?php echo $ERROR_MSG; ?>
</div>
</div>
<?php } ?>
<div class="clearfix"></div>
<div class="row">
<div class="col-12">
<div class="panel panel-default">
<div class="panel-heading"><span class="glyphicon glyphicon-edit"></span> <?php echo $title; ?></div>
<div class="panel-body">
<div class="margin10">
<form class="form-horizontal" name="form1" id="form1" action="<?php echo generate_admin_link("category_auth"); ?>" method="post">
<input type="hidden" name="mode" value="<?php echo ($_GET["mode"] == "add") ? "add_new" : "update"; ?>">
<input type="hidden" name="id" value="<?php echo safe_input($_GET["id"]); ?>">
<input type="hidden" name="pagenum" value="<?php echo safe_input($_GET["pagenum"]); ?>">
<fieldset>
<div class="form-group">
<label class="col-2 control-label" for="ct_name"><span class="required">*</span>ชื่อหมวดหมู่ : </label>
<div class="col-6">
<input type="text" placeholder="ชั้นมัธยมศึกษาปีที่ 1" id="ct_name" autocomplete="off" name="ct_name" class="form-control" value="<?php echo $results[0]["ct_name"]; ?>">
</div>
</div>
<div class="form-group">
<label class="col-2 control-label" for="is_active"><span class="required">*</span>สถานะ : </label>
<div class="col-6">
<label style="margin-top: 5px;">
<input type="checkbox" value="yes" id="is_active" name="is_active" <?php echo ($_GET["mode"] == "add") ? "checked" : ""; ?> <?php echo ($_GET["mode"] == "edit" && $results[0]["active"] == "yes") ? "checked" : ""; ?> > เปิดสอบ
</label>
</div>
</div>
<div class="form-group">
<div class="col-10 col-offset-2">
<button class="btn btn-primary" type="submit">บันทึก</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="<?php echo get_admin_url(); ?>js/jquery.validate.js"></script>
<script type="text/javascript">
jQuery().ready(function() {
// validate signup form on keyup and submit
jQuery("#form1").validate({
rules: {
ct_name: {
required: true,
minlength: 1
},
},
errorElement: "span",
errorClass: "help-inline",
onkeyup: false,
onfocusout: true,
onclick: false,
onfocusin: false,
highlight: function(element) {
jQuery(element).parent().parent().removeClass("has-success");
jQuery(element).closest('div').parent().addClass("has-error");
},
unhighlight: function(element) {
jQuery(element).parent().parent().removeClass("has-error");
jQuery(element).closest('div').parent().addClass("has-success");
}
});
});
</script>
<?php
include './includes/footer.php';
require '../configs/app_bottom.php';
?>