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

$no = $_GET['no'];

$result=mysql_query("select * from lreason where no='$no'");
$r=mysql_fetch_array($result);

$id = $r['id'];
$sd = $r['sd'];
$ed = $r['ed'];
$sh = $r['sh'];
$eh = $r['eh'];
$h = $r['h'];
$re = $r['r'];
$Date = $r['Date'];
$lr = $r['lr'];


$query =mysql_query("Insert into lapp(id,sd,ed,sh,eh,h,re,Date,lr)value('$id','$sd','$ed','$sh','$eh','$h','$re','$Date','$lr')");
$query2 =mysql_query("delete from lreason where no='$no'");
if(($query)&&($query2)){
			echo "<script language='javascript'>alert('Approved.')</script>";
			echo "<script language='javascript'>window.location='leave.php?id=$id'</script>";

}

			echo "<script language='javascript'>alert('Fail.')</script>";
			echo "<script language='javascript'>window.location='leave.php?id=$id'</script>";