<?php
	include 'includes/session.php';
	include 'includes/sessions.php'; 

	if(isset($_POST['add'])){
		$employee_id = $_POST['employee_id'];
		$salary = $_POST['salary'];
		$date=$_POST['dates'];
		$month=$_POST['month'];
		$gross=$_POST['gross'];
		$bonus=$_POST['bonus'];
		$absent=$_POST['absent'];
		$name=$_POST['name'];

		$sql = "INSERT INTO salary (employee_id, salary,dates,month,gross,bonus,absent,name) VALUES ('$employee_id', '$salary','$date','$month','$gross','$bonus','$absent','$name')";
		if($conn->query($sql)){

			$_SESSION['success'] = 'salary added successfully';
		}
		else{ 
			$_SESSION['error'] = $conn->error;
		}
	}	
	else{
		$_SESSION['error'] = 'Fill up add form first';
	}

	header('location: pay_salary.php');

?>