<?php
	session_start();
	include"../../connect/db.php"; 
?> 
 <?php
 $chap = $_SESSION['chap'];
        csrf_verify();
 	if( isset($_POST['tenure']) ){
       

 		$credit_facility = mysqli_real_escape_string($mysqli,$_POST['credit_facility']);
 		$amt = mysqli_real_escape_string($mysqli,$_POST['amt']);
 		$tenure = mysqli_real_escape_string($mysqli,$_POST['tenure']);
        $purpose = mysqli_real_escape_string($mysqli,$_POST['purpose']);
        $amt = mysqli_real_escape_string($mysqli,$_POST['amt']);
        $d_o_t = date("Y-m-d");	

 	//	$sql = mysqli_query($mysqli,"SELECT * FROM loan WHERE user = '$chap' AND account_num = '$accno' ");
 		$kay = mysqli_query($mysqli,"INSERT INTO loan (user,credit_facility,tenure,purpose,amt,status,date) VALUES 
		('$chap', '$credit_facility','$tenure','$purpose','$amt','Pending','$d_o_t')");

 		if( $kay ){
 			echo "success";
 		}
 			else{
 				echo mysqli_error($mysqli);
 			}
 		}
 		else{
 			echo"error";
 		}
 	

 ?>