-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathadd-creditor.php
More file actions
35 lines (22 loc) · 1.12 KB
/
add-creditor.php
File metadata and controls
35 lines (22 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include("includes/db_conn.php");
if(isset($_POST['btn-cred']))
{
$cust_name = mysqli_real_escape_string($db, $_POST['cust_name']);
$cust_loc = mysqli_real_escape_string($db, $_POST['cust_loc']);
$cust_no = mysqli_real_escape_string($db, $_POST['cust_no']);
$cust_qty = mysqli_real_escape_string($db, $_POST['cust_qty']);
$total_amt = mysqli_real_escape_string($db, $_POST['total_amt']);
$amt_paid = mysqli_real_escape_string($db, $_POST['amt_paid']);
$pymt_period = mysqli_real_escape_string($db, $_POST['payment_period']);
$date_taken = mysqli_real_escape_string($db, $_POST['date_taken']);
$status = "Not Paid";
$insert_cred = "INSERT INTO tbl_creditors(cust_name, location, phone_number, qty, total_amount, amount_paid, payment_period, date_taken, cred_status)VALUES('$cust_name', '$cust_loc', '$cust_no', '$cust_qty', '$total_amt', '$amt_paid', '$pymt_period', NOW(), '$status')";
$run_cred = mysqli_query($db, $insert_cred);
if($run_cred)
{
echo "<script>alert('Creditor added successfully!')</script>";
echo "<script>document.location='creditors.php'</script>";
}
}
?>