-
Notifications
You must be signed in to change notification settings - Fork 0
/
Last_Page.php
184 lines (148 loc) · 3.59 KB
/
Last_Page.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
include 'connection.php';
if(isset($_REQUEST['submit']))
{
$Amt=$_GET['amt'];
$Sender_name=$_GET['Sender'];
$Sender_Amt=$_GET['Sender_amount'];
$Receiver_name=$_REQUEST['rbutt'];
$sql3= "SELECT `Email`,`Current Balance` FROM `customer` WHERE `Customer Name` = '$Receiver_name' ";
$q=mysqli_query($dbvar,$sql3);
$Receiver_Amt_arr=mysqli_fetch_array($q);
$Receiver_Amt=$Receiver_Amt_arr[1];
$insertsql= "INSERT INTO `transfer`(`Sender_Name`, `Receiver_Name`, `Transfer_Amount`) VALUES ('$Sender_name','$Receiver_name','$Amt')" ;
if(mysqli_query($dbvar,$insertsql))
{
echo "Transfer Table updated";
}
$newamt1=$Amt+$Receiver_Amt;
$newamt2=$Sender_Amt-$Amt;
$sql1 = "UPDATE `customer` SET `Current Balance`='$newamt1' WHERE `Customer Name`= '$Receiver_name'";
$sql2 = "UPDATE `customer` SET `Current Balance`='$newamt2' WHERE `Customer Name`= '$Sender_name'";
if(mysqli_query($dbvar, $sql1))
{
echo "<br>"."Receiver Data Updated ";
}
else
{
echo "<br>"."Receiver Data not updated";
}
if(mysqli_query($dbvar, $sql2))
{
echo "<br>"."Sender Data Updated ";
}
else
{
echo "<br>"."Sender Data not updated";
}
if(mysqli_query($dbvar, $sql1) && mysqli_query($dbvar, $sql2) )
{
?>
<script>
alert("Transaction is Successful");
</script>
<?php
}
else
{
header("location:Fourth_Page.php");
?>
<script>
alert("Transaction is NOT Successful");
</script>
<?php
}
}
?>
<html>
<head>
<title>Last Page</title>
<link rel="icon" type="image/jpg" href="TSFIMG.png" ></link>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 80%;
margin-left:auto;
margin-right:auto;
}
td, th {
border: 1px solid #dddddd;
text-align: center;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
.container .btn {
position: absolute;
top: 90%;
left: 45%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #f1f1f1;
color: black;
font-size: 16px;
padding: 16px 30px;
border: none;
cursor: pointer;
border-radius: 5px;
text-align: center;
}
.container .btn1 {
position: absolute;
top: 90%;
left: 60%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #f1f1f1;
color: black;
font-size: 16px;
padding: 16px 30px;
border: none;
cursor: pointer;
border-radius: 5px;
text-align: center;
}
.container .btn:hover {
background-color: black;
color: white;
}
.container .btn1:hover {
background-color: black;
color: white;
}
</style>
</head>
<body>
<form name="myform" method="get" >
<h2 align="center">Cutomer Details with updated Balance </h2>
<table>
<tr>
<th>Customer Name</th>
<th>Email</th>
<th>Current Balance</th>
</tr>
<?php
$display= "select * from customer";
$query=mysqli_query($dbvar,$display);
while($res=mysqli_fetch_array($query))
{
?>
<tr>
<td><?php echo $res[0] ?></td>
<td><?php echo $res[1] ?></td>
<td><?php echo $res[2] ?></td>
</tr>
<?php
}
?>
</table>
<div class="container">
<br><br>
<Center><button class="btn" name="button1" formaction="Home_Page.php" target="_self">Home</button>
<button class="btn1" name="button2" formaction="Transfer_Page.php" target="_blank">Transfer History</button></center>
</div>
</form>
</body>
</html>