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

$StaffID = $_GET["StaffID"];
$mon  = $_POST["mon"];
$tue  = $_POST["tue"];
$wed  = $_POST["wed"];
$thur = $_POST["thur"];
$fri  = $_POST["fri"];
$sat   = $_POST["sat"];
$sun  = $_POST["sun"];



$result2 = mysql_query("Select * From staff where StaffID='$StaffID' ");

if($row2 = mysql_fetch_array($result2)){
$Username = $row2["Username"];
}

$query1=mysql_query("INSERT INTO dutytime(StaffID,Username,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday) VALUES ('$StaffID','$Username','$mon','$tue','$wed', '$thur','$fri','$sat','$sun' )");
if($query1){



				

		echo "<script language='javascript'>alert('Arrange Successful.')</script>";
		echo "<script language='javascript'>window.location='dutytime.php'</script>";
}else
		echo 	"<script language='javascript'>alert('Arrange Fail.')</script>";
		echo "<script language='javascript'>window.location='dutytime.php'</script>";
?>
