-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_charges.php
executable file
·143 lines (133 loc) · 6.66 KB
/
update_charges.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
<?php
session_start();
include('config/config.php');
include('config/checklogin.php');
check_login();
if(isset($_POST['charges']))
{
//Prevent Posting Blank Values
if ( empty($_POST["charge_name"]) || empty($_POST["charge_desc"]) || empty($_POST['charge_amount']) )
{
$err="Blank Values Not Accepted";
}
else
{
$charge_name = $_POST['charge_name'];
$charge_desc = $_POST['charge_desc'];
$charge_amount = $_POST['charge_amount'];
$update = $_GET['update'];
//Insert Captured information to a database table
$postQuery="UPDATE charges SET charge_name =?, charge_desc =?, charge_amount =? WHERE charge_id =?";
$postStmt = $mysqli->prepare($postQuery);
//bind paramaters
$rc=$postStmt->bind_param('sssi', $charge_name, $charge_desc, $charge_amount, $update);
$postStmt->execute();
//declare a varible which will be passed to alert function
if($postStmt)
{
$success = "Charge Updated" && header("refresh:1; url=manage_charges.php");
}
else
{
$err = "Please Try Again Or Try Later";
}
}
}
require_once('partials/_head.php');
require_once('config/code-generator.php');
?>
<body>
<!-- BEGIN LOADER -->
<div id="load_screen"> <div class="loader"> <div class="loader-content">
<div class="spinner-grow align-self-center"></div>
</div></div></div>
<!-- END LOADER -->
<!-- BEGIN NAVBAR -->
<?php
require_once('partials/_navbar.php');
$update = $_GET['update'];
$ret="SELECT * FROM charges WHERE charge_id = '$update'";
$stmt= $mysqli->prepare($ret) ;
$stmt->execute();
$res=$stmt->get_result();
while($c=$res->fetch_object())
{
?>
<!-- BEGIN NAVBAR -->
<div class="sub-header-container">
<header class="header navbar navbar-expand-sm">
<a href="javascript:void(0);" class="sidebarCollapse" data-placement="bottom"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></a>
<ul class="navbar-nav flex-row">
<li>
<div class="page-header">
<nav class="breadcrumb-one" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Dashboard</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Charges</a></li>
<li class="breadcrumb-item active" aria-current="page"><span>Update <?php echo $c->charge_name;?></span></li>
</ol>
</nav>
</div>
</li>
</ul>
</header>
</div>
<!-- END NAVBAR -->
<!-- BEGIN MAIN CONTAINER -->
<div class="main-container" id="container">
<div class="overlay"></div>
<div class="search-overlay"></div>
<!-- BEGIN SIDEBAR -->
<?php require_once('partials/_sidebar.php');?>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT PART -->
<div id="content" class="main-content">
<div class="container">
<div class="container">
<br>
<div class="row">
<div id="flFormsGrid" class="col-lg-12 layout-spacing">
<div class="statbox widget box box-shadow">
<div class="widget-header">
<div class="row">
<div class="col-xl-12 col-md-12 col-sm-12 col-12">
<h4>Fill All Fields</h4>
</div>
</div>
</div>
<div class="widget-content widget-content-area">
<form method="POST" enctype="multipart/form-data">
<div class="form-row mb-4">
<div class="form-group col-md-6">
<label for="inputEmail4">Charge Name</label>
<input type="text" value="<?php echo $c->charge_name;?>" name="charge_name" class="form-control">
</div>
<div class="form-group col-md-6">
<label for="inputPassword4">Charge Amount</label>
<input type="text" name="charge_amount" value="<?php echo $c->charge_amount;?>" class="form-control">
</div>
</div>
<div class="form-row mb-4">
<div class="form-group col-md-12">
<label for="inputAddress">Charge Description</label>
<textarea name="charge_desc" rows="10" class="form-control"><?php echo $c->charge_desc;?></textarea>
</div>
</div>
<button type="submit" name="charges" class="btn btn-primary mt-3">Update Charges</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require_once('partials/_footer.php');
?>
</div>
<!-- END CONTENT PART -->
</div>
<?php require_once('partials/_scripts.php'); }?>
</body>
</html>