Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/addsubject.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="subject.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_subject" action="insert_subject.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="subject_code" id="subject_code" 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">
                                                <div class="form-group label-floating is-empty">
                                                    <label class="control-label"></label>
                                                    <input name="subject_name" id="subject_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">
                                                <div class="form-group label-floating is-empty">
                                                    <label class="control-label"></label>
                                                    <input name="credit" id="credit" 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="subject_class_id" id="subject_class_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="course" 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="subject.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 () {
        $("#subject_code").focus();

        //select2



        var spinner = new Spinner().spin();
        $("#spin").append(spinner.el);
        $("#spin").hide();

        $('#form_subject').on("submit", function (e) {
            if ($('#form_subject').smkValidate()) {
                //upload file via ajax setting
                $.ajax({
                    url: 'insert_subject.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_subject')[0].reset();
                    $("#subject_code").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>

Zerion Mini Shell 1.0