-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransactions.php
93 lines (77 loc) · 2.07 KB
/
transactions.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php include('config.php') ;
session_start();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Transaction</title>
</head>
<body>
<form method="post">
<table>
<tr>
<td>Your Account Number</td>
<td><input type="text" name="ac" ></td>
</tr>
<tr>
<td>Beneficiary Account No.</td>
<td><input type="number" name="ban"></td>
</tr>
<tr>
<td>Confirm Beneficiary Account No.</td>
<td><input type="number" name="noo"></td>
</tr>
<tr>
<td>Date</td>
<td><input type="text" name="date"></td>
</tr>
<tr>
<td>Amount</td>
<td><input type="number" name="amt"></td>
</tr>
<tr>
<td>Account Type</td>
<td><input type="radio" name="acc" value="Savings">Savings
<input type="radio" name="acc" value="Current">Current</td>
</tr>
<tr>
<td><input type="submit" name="k" value="Transfer"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['k'])){
$id=$_SESSION['user']['ID'];
$ac=$_POST['ac'];
$ban=$_POST['ban'];
$date=$_POST['date'];
$amt=$_POST['amt'];
$acc=$_POST['acc'];
$accbal=$_SESSION['user']['BALANCE'];
if($accbal>=$amt)
{
$rembal=$accbal-$amt;
$signup="INSERT INTO transactions VALUES('0','$ac','$ban','$date','$amt','$acc')";
$exec=mysqli_query($con,$signup) or die(mysqli_error($con));
if($exec==1)
{
echo"<p style='color:green;background-color:lightyellow'><strong>TRANSACTION DETAILS SAVED SUCCESFULLY</p>";
}
$up="UPDATE customer_details SET BALANCE= '$rembal' WHERE ID ='$id'";
$exec1=mysqli_query($con,$up) or die(mysqli_error($con));
if($exec==1)
{
echo"<p style='color:green;background-color:lightyellow'><strong>BALANCE UPDATEDs</p>";
}
}
else
{
echo "Insufficient Balance!";
?>
<a href="transactions.php"</a>
<?php
}}
?>
</body>
</html>