<?php 
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");

$userid=$_SESSION["userid"];

$ven_name=$_POST["bname"];
$date=$_POST["date"];
$acc_name_dr=$_POST["acc_name_dr"];
$month_name=$_POST["month_name"];
$username=$_POST["username"];
$amount=$_POST["amount"];
$sqlpur = "SELECT * FROM vendor where bname = '$ven_name' and user_id = '$userid'";
$resultpur=$conn->query($sqlpur);
$rowpur = $resultpur->fetch_assoc();
$venid=$rowpur['id'] ;

$sql = "Insert into payment (id,date,month_name,ven_name,username,user_id,netamount,venid) values (null,'$date','$month_name','$ven_name','$username','$userid','$amount','$venid')";
$conn->query($sql);
$last_id = $conn->insert_id;


header("location:Add_Payment.php");

?>
