-
Notifications
You must be signed in to change notification settings - Fork 0
/
addbalance.php
110 lines (83 loc) · 3.36 KB
/
addbalance.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
<?php
include("connection.php");
$aid = ! empty($_SESSION['aid']) ? $_SESSION['aid'] : ' ';
if($aid==" ")
{
echo "<script>window.location.href='homepage.php'</script>";
}
else
{
include("adminmenu.php");
?>
<script>
function showHint(str) {
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET", "getdd_addbalance.php?userid="+str, true);
xmlhttp.send();
}
}
</script>
<div class="row">
<div class="col-md-4 col-md-offset-4">
<br>
<center><h2 class="font-alt">Add Balance</h2></center>
<br>
<form action="" class="form contact-form" enctype="multipart/form-data" method="post">
<div class="clearfix">
<div class="form-group">
<label for="dd_foodid" style="float: left;">User ID:</label>
<select id="dd_studentid" onchange="showHint(this.value)" class="input-md form-control" name="dd_studentid" required>
<option value="">Select UserId</option>
<?php
$sel = "select uid from mmstores";
$rel=$con->query($sel);
if(mysqli_num_rows($rel)==0)
{
echo "<option value='nodata'>--No records to display--</option>";
}
else
{
while($data=mysqli_fetch_array($rel))
{
echo "<option value='".$data['uid']."'>".$data['uid']."</option>";
}
}
?>
</select>
</div>
<div id="txtHint">
</div>
</div>
</div>
</div>
<?php
if(isset($_POST['btn_update']))
{
$userid = $_POST['dd_studentid'];
$name = $_POST['name'];
$st_walletamt = $_POST['st_walletamt'];
$amt_update = $_POST['amt_update'];
$totalamt_update = ($st_walletamt + $amt_update);
$sql_update = "Update mmstores set Bal='$totalamt_update' where
uid='$userid'";
if(mysqli_query($con, $sql_update))
{
echo "<script>alert('Amount updated successfully');</script>";
}
else
{
echo "<script>alert('Please Try again');</script>";
}
}
}
?>
</form>