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

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

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

  if (isset($_GET['valueid'])) {

    $valueid = mysqli_real_escape_string($db,$_GET['valueid']);
    $employeeid = mysqli_real_escape_string($db,$_GET['employeeid']);

    $sqlDeleteEmployeeValue = "
    DELETE FROM
    valuesbyemployee
    WHERE valueid = $valueid;";

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

      $positionUpdate = "User deleted Employee Value ";

      logEvent($db,"Employee Value Deleted",$positionUpdate,$last_id);
      
      header("location: viewEmployee.php?employeeID=$employeeid");

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

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

?>