<?php
session_start();
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: index.php");
} 
 //include 'logoff.html';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PMS Member's Only</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet" type="text/css" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript">
  function checkForm(form)
  {
    
    if(form.NumberOfPorters.value == "" || form.NumberOfPorters.value =="0") {
      alert("Input can not be Empty! or Zero");
      form.NumberOfPorters.focus();
      return false;
    }
    var re = /^[0-9]+$/;
	
    if(!re.test(form.NumberOfPorters.value)) {
      alert("Number Only");
      form.NumberOfPorters.focus();
      return false;
    }
	
    return true;
  }

</script>
</head>
<body>
<div id="header" class="container">
	<div id="logo">
		<h1><a href="#">PMS - Porter's Management System</a></h1>
	</div>
</div>

<div id="page" class="container">
	<div id="sidebar1">
		<div id="box1"><ul class="style1">
				<li class="first"><a href="select.php" class="link-style">SELECT PORTERS</a></li>
				<li><a href="addporters.php" class="link-style">ADD PORTERS</a></li>
                <li><a href="editall.php" class="link-style">Edit</a></li>
				<li><a href="#" class="link-style">DELETE PORTER</a></li>
				<li><a href="update.php" class="link-style">UPDATE INDIVIDUAL INFO</a></li>
                <li><a href="resetall.php" class="link-style">Reset All INFO</a></li>
                <li><a href="logout.php" class="link-style">Logout</a></li>
			</ul>
            </div>
	</div>
	<div id="content" align="center">


    <?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 LIKE'%$idNumber%'";
    if(mysqli_query($link, $sql)){

        echo "Porter with A/C Number."." ".$idNumber.""." "."Has been removed";
		echo "<br>"."<br>".'<a href="#">'."Return >>"."</a>";

    } else{

        echo "Error !".mysqli_error($link);
		echo "<br>"."<br>".'<a href="#">'."Try Again"."</a>";

    }

    mysqli_close($link);

    ?>

</div>
		
</div>
<div id="footer">
	<p>&copy; Private Kilimanjaro. All rights reserved. Design by <a href="#">Pamoja Web Solutions</a></p>
</div>
</body>
</html>
