ok

Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/home/ngwcolle/public_html/mis/admin/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/home/ngwcolle/public_html/mis/admin/update_employee.php

<?php
session_start();
error_reporting(1);
include('includes/dbconnection.php');
if (isset($_POST['saveupdates'])) {
  $adminid = $_SESSION['editid2'];
  $accounthead = $_POST['firstname2'];
  $bankacc = $_POST['lastname2'];
  $bankname = $_POST['empdept'];
  $ifsc = $_POST['emptype'];
  $signatory = $_POST['sign'];
  $mobile = $_POST['amtbal'];
  $sql4 = "update tblemployee set empname=:firstname2,designation=:lastname2,mobilno=:lastname3,basicpay=:mobilenumber2,emptype=:signatory,empdept=:amtbalance where id=:aid";
  $query4 = $dbh->prepare($sql4);
  $query4->bindParam(':firstname2', $accounthead, PDO::PARAM_STR);
  $query4->bindParam(':lastname2', $bankacc, PDO::PARAM_STR);
  $query4->bindParam(':lastname3', $mobile, PDO::PARAM_STR);
  $query4->bindParam(':mobilenumber2', $signatory, PDO::PARAM_STR);
  $query4->bindParam(':signatory', $ifsc, PDO::PARAM_STR);
  $query4->bindParam(':amtbalance', $bankname, PDO::PARAM_STR);
  $query4->bindParam(':aid', $adminid, PDO::PARAM_STR);
  $query4->execute();
  if ($query4->execute()) {
    echo '<script>alert("Employee details has been updated")</script>';
    echo "<script>window.location.href ='employee_register.php'</script>";
  } else {
    echo '<script>alert("update failed! try again later")</script>';
  }
}
?>
<div class="card-body">
  <h5 class="card-title p-0">Update Employee Form </h5>
  <form method="post" enctype="multipart/form-data">
    <?php
    $eid = $_POST['edit_id'];
    $sql = "SELECT * from   tblemployee where id=:eid";
    $query = $dbh->prepare($sql);
    $query->bindParam(':eid', $eid, PDO::PARAM_STR);
    $query->execute();
    $results = $query->fetchAll(PDO::FETCH_OBJ);
    $cnt = 1;
    if ($query->rowCount() > 0) {
      foreach ($results as $row) {
        $_SESSION['editid2'] = $row->id;

    ?>
        <div class="row ">
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Employee Name</label>
            <input type="text" name="firstname2" class="form-control" id="firstname2" value="<?php echo $row->empname; ?>" required>
          </div>
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Designation</label>
            <input type="text" name="lastname2" class="form-control" id="lastname2" value="<?php echo $row->designation; ?>" required>
          </div>
        </div>
        <div class="row">
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Employee Type</label>
            <select name="emptype" id="" class="form-control" required>
<option value="">--Employee Type--</option>
<option value="Regular" <?php if($row->emptype=="Regular") echo 'selected="selected"'; ?>>Regular</option>
<option value="Adhoc" <?php if($row->emptype=="Adhoc") echo 'selected="selected"'; ?>>Adhoc</option>
<option value="Contractual" <?php if($row->emptype=="Contractual") echo 'selected="selected"'; ?>>Contractual</option>
<option value="Outsourcing" <?php if($row->emptype=="Outsourcing") echo 'selected="selected"'; ?>>Outsourcing</option>
<option value="Guest" <?php if($row->emptype=="Guest") echo 'selected="selected"'; ?>>Guest</option>

                </select>
          </div>
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Employee Dept</label>
            <select name="empdept" id="" class="form-control" required>
<option value="">--Employee Role--</option>
<option value="Teaching" <?php if($row->empdept=="Teaching") echo 'selected="selected"'; ?>>Teaching</option>
<option value="Non-Teaching" <?php if($row->empdept=="Non-Teaching") echo 'selected="selected"'; ?>>Non-Teaching</option>
<!-- <option value="Contractual">Contractual</option>
<option value="Outsourcing">Outsourcing</option>
<option value="Guest">Guest</option> -->

                </select> 
          </div>
          </div>
          <div class="row">
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Basic Pay</label>
            <input type="number" name="sign" class="form-control" value="<?php echo $row->basicpay; ?>" required>
          </div>
          <div class="form-group col-md-6">
            <label for="exampleInputName1">Mobile No</label>
            <input type="number" name="amtbal" class="form-control" value="<?php echo $row->mobilno; ?>" required>
          </div>
          </div>
      <?php
      }
    } ?>
      <button type="submit" name="saveupdates" class="btn btn-primary btn-fw mr-2">Update</button>
      <button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button>
  </form>
</div>

Zerion Mini Shell 1.0