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

$Position = $_POST["position"];
$LimitType = $_POST["limittype"];
$LimitHours = $_POST["limithours"];

if(($Position == "")||($LimitType == "")||($LimitHours == "")){
	echo "<script>alert('Please fill in your form completely')</script>";
	echo "<script language='javascript'>window.location='arrangeleave.php'</script>";
}else
{
$query = "INSERT INTO leavelimit(Position, LeaveType, Hours)VALUES('$Position', '$LimitType', '$LimitHours')";
$result = $db->query($query);					
		$db->close();
		echo "<script language='javascript'>alert('Arrange Leave Limit Successful.')</script>";
		echo "<script language='javascript'>window.location='adminaccount.php'</script>";
}
?>