<?php ob_start(); session_start(); ?>
<?php
include "layouts/db_connect.php";

		 if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   $mfin = $_SESSION['mfin'];
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
	}
	
$idd = $_GET['idd'];
$sql = mysqli_query($conn, "select * from hloan where idd ='$idd'");
$row2 = mysqli_fetch_array($sql);
$cdate = date("d-m-Y H:i:s");

$insert=mysqli_query($conn, "insert into chloan(date,date2,agent,hpl,actamt,postamt,mfin,scode)
values('".$row2['date']."','".$row2['$date2']."','".$row2['agent']."','".$row2['hpl']."','".$row2['actamt']."','".$row2['postamt']."','".$row2['mfin']."','".$row2['scode']."')");
						
mysqli_query($conn, "DELETE FROM hloan where idd = '$idd'");

echo "<script>alert('Cancelled successfully');window.location.href='index2.php'</script><br>";

?>


