<?
require("config.inc");
$adminID = $_GET['adminID'];
$staffID = $_GET['staffID'];

$result = mysql_query("Select * from tbl_user where user_ID='$staffID'");
						while ($row=mysql_fetch_array($result))
						{
							$name = $row['username'];
							$pass = $row['password'];
							$addr = $row['address'];
							$sex = $row['sex'];
							$birth = $row['birthday'];
							$email = $row['email'];
						}

//echo "<script>alert('".$productType."');</script>";
$result = mysql_query("insert into tbl_leaveuser (user_ID,username,password,address,sex,birthday,email) value ('$staffID','$name','$pass','$addr','$sex','$birth','$email')");

//$row = mysql_fetch_array($result);
if($result-->0){
echo "<script>alert('Success');</script>";
mysql_query("delete from tbl_user where user_ID='$staffID'");
echo "<script>window.location='checkStaff.php?adminID=".$adminID."';</script>";
}
else{echo "<script>alert('Failed to update');</script>";
echo "<script>window.location='checkStaff.php?adminID=".$adminID."';</script>";}
?>