<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	

$com=$_POST['com']/100;

$position = $_POST["position"];
$basic = $_POST["basic"];
$overtime = $_POST["overtime"];
$epfrate = $_POST['epfrate']/100;
$result5=mysql_query("select rate from socso where '$basic' between mins and maxs");
$r = mysql_fetch_array($result5);
$so = $r['rate'];
if(($position =="")||($basic =="")||($overtime == "")||($epfrate == "")){
		echo "<script language='javascript'>alert('Please Fill In Completely.')</script>";
		echo "<script language='javascript'>window.location='salaryrate.php'</script>";

}else{
$query =mysql_query("INSERT INTO salaryrate(position,basic,overtime,epfrate,socso,cepf)VALUES('$position','$basic','$overtime','$epfrate','$so','$com')");
if($query){		
		echo "<script language='javascript'>alert('Add salaryrate Successful.')</script>";
		echo "<script language='javascript'>window.location='viewsalaryrate.php'</script>";
		}else{
		echo "<script language='javascript'>alert('Add salaryrate Failed.')</script>";
		echo "<script language='javascript'>window.location='viewsalaryrate.php'</script>";
		
		}
	}



?>