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/addstudent.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="student.php">จัดการนักเรียน</a></li>
                       <li class="breadcrumb-item active" aria-current="page">เพิ่มนักเรียน</li>
                       </ol>
                     </nav>
                            
                      <?php
                        $year = $s_year;
                        $sql = "SELECT * FROM class_room WHERE (`academic_year`='$year')";
                        $result = mysqli_query($link2, $sql);     
                       ?>
                      <!-- เนื้อหา -->    
                          <div class="card">
                           
                                     
                                <div class="card-header card-header-icon" data-background-color="rose">
                                    <i class="fad fa-user-plus fa-2x"></i>
                                </div>
                                <div class="card-content">
                                    <h4 class="card-title">เพิ่มนักเรียน</h4>
                                    <form class="form-horizontal" id="form_student" action="insert_student.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="username" id="username" type="text" class="form-control" minlength="5" maxlength="5" data-smk-msg="กรุณากรอกรหัสนักเรียน 5 หลัก" required>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label class="col-md-3 label-on-left">เพศ</label>
                                            <div class="col-md-9 checkbox-radios">
                                                <div class="radio">
                                                    <label>
                                                        <input type="radio" name="sex" id="sex" value="1" checked="true"> ชาย
                                                    </label>
                                                </div>
                                                <div class="radio">
                                                    <label>
                                                        <input type="radio" name="sex" id="sex" value="2"  required> หญิง
                                                    </label>
                                                </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="name_peple" id="name_peple" type="text" placeholder="----กรอกเฉพาะชื่อเท่านั้น----" 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="sname_peple" id="sname_peple" 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="user_class_id" id="user_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>
                                        <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="student.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 type="text/javascript">
$(document).ready(function(){

//*** Function (Start)
function inputNumberFunction(ctrl) {

    $(ctrl).keydown(function (event) {
        // Allow:  delete, tab, enter and . - , f5 

        if ($.inArray(event.keyCode, [8, 9, 27, 13, 46, 109, 110, 190, 189, 116]) !== -1 ||
        // Allow: Ctrl+A

            (event.keyCode == 65 && event.ctrlKey === true) ||
        // Allow: home, end, left, right
            (event.keyCode >= 35 && event.keyCode <= 39)) {
            // let it happen, don't do anything
            return;
        }
        else {
            // Ensure that it is a number and stop the keypress
            if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {
                event.preventDefault();
            }
        }
    });

    $(ctrl).change(function () {
        var value = $(this).val();
        if (isNaN(value)) {
            $(this).val('0');
              swal('เกิดข้อผิดพลาด!...','กรุณากรอกเฉพาะตัวเลขเท่านั้น!...','error');
              $(this).focus();
        }
    });

}
//*** Function (End)

inputNumberFunction("#username");

});
</script>


<script>
    $(document).ajaxStart(function () {
        $("#spin").show();
    }).ajaxStop(function () {
        $("#spin").hide();
    });

    $(document).ready(function () {
        $("#username").focus();

        //select2



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

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