-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpense_edit.php
129 lines (96 loc) · 3.54 KB
/
expense_edit.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
<?php
require_once("header.php");
require_once("sidebar.php");?>
<?php
$p=$_GET['ram'];
$expense_da=$conn->query("SELECT * FROM `expense` WHERE exoenseID=$p");
$result=$expense_da->fetch_assoc();
// echo "<pre>";
// print_r($result);
$mm=$conn->query("SELECT * FROM expense_category");
$bb=$conn->query("SELECT * FROM bank");
if (isset($_POST['submit'])) {
$categoryID=$_POST['categoryID'];
$date=$_POST['date'];
$amount=$_POST['amount'];
$method=$_POST['method'];
$bankID=$_POST['bankID'];
$conn->query("UPDATE `expense` SET `categoryID` = '$categoryID',`date`='$date', `amount` = '$amount', `method` = '$method', `bankID` = '$bankID' WHERE `expense`.`exoenseID` = $p");
// UPDATE `expense` SET `exoenseID`='[value-1]',`categoryID`='[value-2]',`date`='[value-3]',`amount`='[value-4]',`method`='[value-5]',`bankID`='[value-6]' WHERE 1
// header("location:expense.php"); ?>
<script>
window.location.assign("expense.php");
</script>
<?php } ?>
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Update Tables</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Update Tables</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Expense</h3>
</div>
<!-- /.card-header -->
<div class="container">
<div class="card-body">
<h1>Update Expense List</h1>
<form action=" " method="post">
<!-- <div> -->
<label for="category name">Category Id:</label>
<select name="id" class="form-control">
<?php
while ($rr=$mm->fetch_assoc()) {
?>
<option value="<?php echo $rr['id'] ?>" ><?php echo $rr['category_name'] ?></option>
<?php } ?>
</select>
<br>
<label for="date">Date:</label>
<input type="date" name="date" placeholder="Enter your date here" class="form-control" value="<?php echo $result['date'] ?>"><br>
<label for="amount">Amount:</label>
<input type="text" name="amount" placeholder="Enter your amount here" class="form-control"value="<?php echo $result['amount'] ?>"><br>
<label for="method">Method:</label>
<select name="method" class="form-control"value="<?php echo $result['method'] ?>">
<option>Cash</option>
<option>Bank</option>
</select>
<br>
<div class="form-group">
<label for="bankID">Bank Name:</label>
<select name="bankID" class="form-control">
<?php
while ($ebank=$bb->fetch_assoc()) {
?>
<option value="<?php echo $ebank['bankID'] ?>"><?php echo $ebank['bank_name'] ?></option>
<?php } ?>
</select>
</div>
<td colspan="6">
<input type="Submit" name="submit" value="Submit"class="btn btn-outline-primary btn btn-block">
</td>
</form>
</div>
</div>
</div>
</div>
<!-- /.card -->
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<?php require("footer.php"); ?>