<?php  
include ('../includes/connection.php'); 
$student_id=$_GET['id']; 
if (isset($_POST['update'])) {  
$student_id=$_GET['id']; 
$student_address = $_POST['student_address']; 
$student_name = $_POST['student_name'];
$company = $_POST['company'];
$student_email_id = $_POST['student_email_id'];
$student_contact_no = $_POST['student_contact_no'];    

$sql = "UPDATE `student_soes` SET `student_address`='$student_address' ,`student_name`='$student_name',`company`='$company',`student_email_id`='$student_email_id',`student_contact_no`='$student_contact_no' WHERE student_id='$student_id'"; 
  if (mysqli_query($conn, $sql)) {
      ?>
       <script type="text/javascript">
           alert("Trainer successfully updated");
       </script>
      <?php  
  //header('location:tp_student.php');
          } 
        else {
            ?>
           <script type="text/javascript">
               alert("Failed to update Trainer 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 Training</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="#">Manage User</a></li>
              <li class="breadcrumb-item active">Training</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <?php 
    $query= mysqli_query($conn,"SELECT *  FROm  student_soes  WHERE student_id='$student_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-12">
            <div class="card"> 
              <!-- /.card-header --> 
              <div class="card-body"> 
                <div class="tab-content">
                   <!-- /.tab-pane -->
                  <div class="active tab-pane" id="timeline">
                   <div class="card card-default">
                    <div class="card-header">
                      <h3 class="card-title">Update Student Detail For  <strong><?php echo $row['student_name']?></strong></h3> 
                      <div class="card-tools">
                        <button type="button" class="btn btn-tool" data-card-widget="collapse">
                          <i class="fas fa-minus"></i>
                        </button> 
                      </div>
                    </div>
                    <form action="" method="post" enctype="multipart/form-data"> 
                    <!-- /.card-header -->
                    <div class="card-body">
                      <div class="row"> 
                          <div class="col-sm-4">
                          <div class="form-group">
                            <label>Trainer Name<span style="color: red;">*</span></label>
                            <input type="text" name="student_name" id="student_name" class="form-control" value="<?php echo $row['student_name']?>" />
                          </div>
                        </div>
                        <div class="col-sm-4">
                          <div class="form-group">
                            <label>Trainer Address<span style="color: red;">*</span></label>
                            <input type="text" name="student_address" id="student_address" class="form-control" value="<?php echo $row['student_address']?>" />
                          </div>
                        </div>
                        <div class="col-sm-4">
                          <div class="form-group">
                            <label>Trainer Company<span style="color: red;">*</span></label>
                            <input type="text" name="company" id="company" class="form-control" value="<?php echo $row['company']?>" />
                          </div>
                        </div>
                        </div>
                        <!-- /.col -->
                       <div class="row">  
                        <div class="col-sm-6">
                          <div class="form-group">
                            <label>Student Mobile <span style="color: red;">*</span></label>
                            <div class="input-group">
                               <div class="input-group-prepend">
                                <span class="input-group-text"><i class="fas fa-phone"></i></span>
                             </div>
                            <input type="text" name="student_contact_no" id="student_contact_no" class="form-control" data-parsley-type="integer" data-parsley-minlength="10" data-parsley-maxlength="12" value="<?php echo $row['student_contact_no']?>"pattern="[0]{1}[0-9]{9}" data-parsley-trigger="keyup" />
                         </div>
                          </div>
                        </div> 
                        <div class="col-sm-6">
                          <div class="form-group">
                            <label>Student Email <span style="color: red;">*</span></label>
                            <input type="text" name="student_email_id" id="email" class="form-control" data-parsley-type="email" data-parsley-maxlength="150" data-parsley-trigger="keyup" value="<?php echo $row['student_email_id']?>"/>
                          </div>
                        </div> 
                       </div> 

                         <div class="modal-footer">  
                          <a class="btn btn-secondary" href="admin.php?page=trainer"><< Back </a>
                          <button type="submit" class="btn btn-primary" name="update">UPDATE </button>
                      </div>
                      <!-- /.row -->
                    </div> 
                  </form>
                  </div>
                   
                    </div>
                    
                     
                     
                  </div>
                  
                  <!-- /.tab-pane -->
                </div>
                <!-- /.tab-content -->
              </div><!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div> 
   <a id="back-to-top" href="#" class="btn btn-primary back-to-top" role="button" aria-label="Scroll to top">
      <i class="fas fa-chevron-up"></i>
    </a>
  <div id="preloader"></div>
  
<script src="../stp_con/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../stp_con/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="../stp_con/datatables/jquery.dataTables.min.js"></script>
<script src="../stp_con/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../stp_con/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../stp_con/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../stp_con/jszip/jszip.min.js"></script> 
<script src="../stp_con/pdfmake/pdfmake.min.js"></script>
<script src="../stp_con/pdfmake/vfs_fonts.js"></script> 
<script src="../stp_con/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../stp_con/datatables-buttons/js/buttons.colVis.min.js"></script>  
<script src="../assets/js/adminlte.min.js"></script>
  

 
 
