<?php
	require_once('functions.php');
	$session=session_id();
if(isset($_POST['submitted'])){

 $dbc=mysqli_connect("localhost","gurudumu_bazuu2","@@karishop@@2023!!","gurudumu_pos");
 $amnt=mysqli_real_escape_string($dbc,trim($_POST['amount']));
$date=mysqli_real_escape_string($dbc,trim($_POST['date']));
$client=mysqli_real_escape_string($dbc,trim($_POST['client']));

 $gj="insert into loans(date,credit,description,account_id,froms,session,dat)values('$date','$amnt','LOAN PAYMENT','$client','0', '$session',NOW())";
$koo=mysqli_query($dbc,$gj);
$kii="insert into loans(date,debit,description,account_id,froms,session,dat)values('$date','$amnt','LOAN PAYMENT','0','$client', '$session',NOW())";
   $mi=mysqli_query($dbc,$kii);
session_regenerate_id();
mysqli_close($dbc);

}
$url="list.php?c=$client&a=$amnt&s=$session";
	ob_end_clean();
header("Location: $url");
?>