| Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/ |
| Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/addclass.php |
<!doctype html>
<html lang="en">
<!-- head -->
<?php include 'head.php'; ?>
<body>
<div class="wrapper">
<!-- เมนูด้านซ้าย -->
<?php include 'leftside.php'; ?>
<div class="main-panel">
<!-- ส่วนหัว -->
<?php include 'header.php'; ?>
<div class="content">
<div class="container-fluid">
<div class="col-md-6">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="home.php">หน้าหลัก</a></li>
<li class="breadcrumb-item"><a href="class.php">จัดการห้องเรียน</a></li>
<li class="breadcrumb-item active" aria-current="page">เพิ่มห้องเรียน</li>
</ol>
</nav>
<?php
$year = $s_year;
$sql = "SELECT * FROM level_class";
$result = mysqli_query($link2, $sql);
?>
<!-- เนื้อหา -->
<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="fad fa-plus-circle fa-2x"></i>
</div>
<div class="card-content">
<h4 class="card-title">เพิ่มห้องเรียน</h4>
<form class="form-horizontal" id="form_class" action="insert_class.php" method="post" novalidate>
<input type="hidden" name="year" id="year" value="<?php echo $year; ?>">
<div class="row">
<label class="col-md-3 label-on-left">ห้องเรียน</label>
<div class="col-md-9">
<div class="form-group label-floating is-empty">
<label class="control-label"></label>
<input name="class_name" id="class_name" type="text" class="form-control" data-smk-msg="กรุณาระบุห้อง" required>
</div>
</div>
</div>
<div class="row">
<label class="col-md-3 label-on-left">ชั้นเรียน</label>
<div class="col-md-9">
<select name="lc_id" id="lc_id" class="form-control" data-style="btn btn-info btn-round" data-smk-msg="กรุณาเลือกชั้นเรียน" required>
<option value="" selected>กรุณาเลือก...</option>
<?php
while ($row = mysqli_fetch_array($result,MYSQLI_NUM)){
echo "<option value='$row[0]'>$row[1]</option>";
}
mysqli_close($dbcon);
?>
</select>
</div>
</div>
<?php
$sql1 = "SELECT * FROM course";
$result1 = mysqli_query($link2, $sql1);
?>
<div class="row">
<label class="col-md-3 label-on-left">หลักสูตร</label>
<div class="col-md-9">
<select name="course_id" id="course_id" class="form-control" data-style="btn btn-round" data-smk-msg="กรุณาเลือกหลักสูตร" required>
<option value="" selected>กรุณาเลือก...</option>
<?php
while ($row1 = mysqli_fetch_array($result1,MYSQLI_NUM)){
echo "<option value='$row1[0]'>$row1[1]</option>";
}
mysqli_close($dbcon);
?>
</select>
</div>
</div>
<div class="row">
<label class="col-md-3"></label>
<div class="col-md-9">
<div class="form-group form-button">
<button type="submit" class="btn btn-fill btn-rose"><i class="fal fa-save fa-lg"></i> บันทึก</button>
<a href="class.php" class="btn btn-primary">
<i class="fad fa-eye fa-lg"></i> เรียกดูข้อมูล
</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="spin"></div>
</div>
</div>
<!-- footer1 -->
<?php include 'footer1.php'; ?>
</div>
</div>
<!-- footer2 -->
<?php include 'footer2.php'; ?>
<script>
$(document).ajaxStart(function () {
$("#spin").show();
}).ajaxStop(function () {
$("#spin").hide();
});
$(document).ready(function () {
$("#class_name").focus();
//select2
var spinner = new Spinner().spin();
$("#spin").append(spinner.el);
$("#spin").hide();
$('#form_class').on("submit", function (e) {
if ($('#form_class').smkValidate()) {
//upload file via ajax setting
$.ajax({
url: 'insert_class.php',
type: 'POST',
data: new FormData(this),
processData: false,
contentType: false,
dataType: 'json'
}).done(function (data) {
if (data.status === "success") {
$.smkAlert({text: data.message, type: data.status});
} else {
$.smkAlert({text: data.message, type: data.status});
}
$('#form_class')[0].reset();
$("#class_name").focus();
});
e.preventDefault();
}
e.preventDefault();
});
});
</script>
<!-- Mirrored from demos.creative-tim.com/material-dashboard-pro/examples/dashboard.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 20 Mar 2017 21:32:16 GMT -->
</html>