<?php

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

	$StaffID =$_GET['StaffID'];
	$position=$_POST["position"];
echo $position;
	
 $result3 = mysql_query("SELECT * from salaryrate where position='$position' ");
	
if($row2 = mysql_fetch_array($result3)){
$basic = $row2['basic'];	
$overtime = $row2['overtime'];
 $epfrate = $row2['epfrate'];
 $e2 = $row2['cepf'];
 $so = $row2['socso'];
 
 } 
   $epf=$basic * $epfrate;
   $epf1=$basic * $e2;
  $result =$basic - $epf - $so;


	

	
	$query2=mysql_query("UPDATE salary SET position='$position',Salary='$basic',Epf='$epf',TSalary='$result',epf1='$epf1' WHERE StaffID='$StaffID' ");
	
	
if($query2){ 	
	echo "<script language=javascript>alert('Changed successful!!');window.location='http://www.wauhaha.com/karaoke/adminviewsalary.php?StaffID=$StaffID</script>";
}
echo "<script language=javascript>alert('Changed successful1!!');window.location='http://www.wauhaha.com/karaoke/adminviewsalary.php?StaffID=$StaffID'</script>";
	
	?>
