<?php 
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
mysql_selectDB("wauhaha_karaoke",$login);
$id = $_GET['id'];
$result2 =mysql_query("select * from leave2 where id='$id'");
$ro = mysql_fetch_array($result2);
$date = $_POST['date'];
$id2=$_POST['id2'];
$l = $_POST['l'];
$y = $_POST['y'];

if(($l=="")||($y=="")){
		echo "<script language='javascript'>alert('Please insert completely.')</script>";
			echo "<script language='javascript'>window.location='editleave.php?id=$id'</script>";die;

}else

$query = mysql_query("Update leave2 set l='$l',year='$y' where id='$id' ");
$query2=mysql_query("Insert into editedleave(id,l,y,ed,eb)value('$id','$l','$y','$date','$id2')");

if($query){
		echo "<script language='javascript'>alert('Edit Success.')</script>";
		echo "<script language='javascript'>window.location='lset.php?id=$id2'</script>";die;

}