<?php  
include ('../includes/connection.php');  
$class_id=$_GET['id'];  
if (isset($_POST['update'])){
$class_id=$_GET['id'];
$class_name = $_POST['class_name']; 
$level = $_POST['level']; 
$query=mysqli_query($conn,"UPDATE `class_srms` SET `class_name`='$class_name',`level`='$level' WHERE class_id='$class_id'");
  
  if($query){ 
         ?>
         <script type="text/javascript">
             alert("Class Success Fully updated");
         </script>
        <?php  
      }  
      else{
        ?>  
        <script type="text/javascript">
         alert("Sorry Class Failed to update Try Again !!");
        </script>
        <?php
    }
  } 
?>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h5><strong>Update class</strong></h5>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item"><a href="#">CLASS MANAGEMENT</a></li> 
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <?php 
    $query= mysqli_query($conn,"SELECT *  FROm class_srms WHERE class_id='$class_id'")or die(mysqli_error());
    $row = mysqli_fetch_array($query);   
    ?> 
   <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row"> 
          <!-- /.col -->
          <div class="col-md-6"> 
              <!-- /.card-header --> 
              <div class="card"> 
                <div class="tab-content"> 
                   <div class="card card-default"> 
                    <form method="post" action=""> 
                        <div class="modal-header">
                            <h4 class="modal-title" id="modal_title">Update Class</h4> 
                        </div>
                        <div class="modal-body">
                          <span id="form_message"></span>
                            <div class="form-group">
                              <label>Class Name</label>
                              <input type="text" name="class_name" id="class_name" value="<?php echo $row['class_name']; ?>" class="form-control" required data-parsley-pattern="/^[a-zA-Z0-9 \s]+$/" data-parsley-trigger="keyup" />
                            </div>
                            <div class="form-group">
                              <label>Class Level <span style="color: red;">*</span></label>
                              <div class="select2-purple"> 
                                <select class="form-control select2" name="level" data-dropdown-css-class="Select a Program" style="width: 100%;" required> 
                                 <option><?php echo $row['level']; ?></option> 
                                <option value="Advance">Advanced level</option>
                                <option value="O-level">O-level</option>  
                              </select>
                              </div> 
                            </div>
                        </div>
                        <div class="modal-footer"> 
                            <input type="submit" name="update" class="btn btn-secondary" value="Update" /> 
                        </div> 
                        </form>
                    </div> 
                  
                  <!-- /.tab-pane -->
                </div>
                <!-- /.tab-content -->
              </div><!-- /.card-body --> 
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

   
<!-- ./wrapper -->
<script src="../stp_con/jquery.min.js"></script>
<script src="../stp_con/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../stp_con/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Select2 -->
<script src="../stp_con/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="../stp_con/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js"></script>
<!-- InputMask -->
<script src="../stp_con/moment/moment.min.js"></script>
<script src="stp_con/inputmask/jquery.inputmask.min.js"></script>
<!-- date-range-picker -->
<script src="../stp_con/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../stp_con/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../stp_con/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- BS-Stepper -->
<script src="../stp_con/bs-stepper/js/bs-stepper.min.js"></script>
<!-- dropzonejs -->
<script src="../stp_con/dropzone/min/dropzone.min.js"></script>
<!-- AdminLTE App -->
<script src="../assets/js/adminlte.min.js"></script>

 
 
