<?php
	$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
$e2 = $_POST['e2'];
$s = $_POST['s'];
$SalaryID = $_POST['SalaryID'];
$staffid = $_GET['StaffID'];
$username = $_POST['username'];
$name = $_POST['name'];
$position = $_POST['position'];
$date1 = $_POST['date'];
$salary = $_POST['salary'];
$overtime1 = $_POST['overtime1'];
$epf = $_POST['epf'];
$total = $_POST['total2'];
$t = $_POST['t'];
$l2=$_POST['l2'];
$query2 =mysql_query("INSERT INTO salarystatement(socso,epf1,SalaryID,StaffID,Username,Name,Salary,Overtime,EPF,TotalSalary,Date,l)VALUES('$s','$e2','$SalaryID','$staffid','$username','$name','$salary','$overtime1','$epf','$total','$t','$l2')");
if($l2<0){
$query3=mysql_query("Update leave2 set l='0' where id='$username'");
}
if($query2){	
			echo "<script language='javascript'>alert('submit Successful.')</script>";
			echo "<script language='javascript'>window.location='adminviewsalary.php?StaffID=$staffid'</script>";
}else
			echo "<script language='javascript'>alert('submit Fail.')</script>";
			echo "<script language='javascript'>window.location='adminviewsalary.php?StaffID=$staffid'</script>";

?>