<?php
   include('session.php');
   include('connect.php');
   include('logging.php');

// start role specific 
$user_role = $_SESSION['role'];

if ($_SERVER["REQUEST_METHOD"] == "POST") {

  if (isset($_POST['employee_id'])) {

    $employee_id = mysqli_real_escape_string($db,$_POST['employee_id']);
    $bank_Name = mysqli_real_escape_string($db,$_POST['bank_Name']);
    $bank_Account = mysqli_real_escape_string($db,$_POST['bank_Account']);

    $sqlUpdateBank = "
    UPDATE employee_bank
    SET employee_bank_name = \"" . $bank_Name . "\",
    employee_bank_account = \"" . $bank_Account . "\"
    WHERE employee_id = $employee_id;";



      if(mysqli_query($db, $sqlUpdateBank)) {

      $employeeUpdate = "User updated employee bank ";

      logEvent($db,"Employee updated",$employeeUpdate,$last_id);
      
      header("location: viewEmployee.php?employeeID=$employee_id");

      } else {
         echo "Error: " . mysqli_error($db);
    }

    } else {
    echo "Employee not selected!!!";
   }
 
}

?>