<?php
session_start();
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: index.php");
} 
 //include 'logoff.html';
?>
<?php
$link = mysqli_connect("localhost", "comeadve_glory1", "Safari#@2027$", "comeadve_tdmc");
if($link === false){

        die("ERROR: Could not connect. " . mysqli_connect_error());

    }
	
    $idNumber = mysqli_real_escape_string($link, $_POST['IDNumber']);
	//$idNumber = $_POST['IDNumber'];
	
    $sql = "DELETE FROM employees WHERE IDNumber='$idNumber'";
    if(mysqli_query($link, $sql)){

       // echo "Porter with A/C Number."." ".$idNumber.""." "."Has been removed";
		$msg = "Porter with A/C Number."." ".$idNumber.""." "."Has been removed";
        header("location:deleteporter.php?msg=$msg");
	
    } else{

       // echo "Error !".mysqli_error($link);
		$msg = "Error !".mysqli_error($link);
        header("location:deleteporter.php?msg=$msg");
		
    }

    mysqli_close($link);
?>