-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_food_items.php
225 lines (161 loc) · 6.33 KB
/
edit_food_items.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
include('session_m.php');
if(!isset($login_session)){
header('Location: managerlogin.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title> Manager Login | Le Cafe' </title>
</head>
<link rel="stylesheet" type = "text/css" href ="css/edit_food_items.css">
<link rel="stylesheet" type = "text/css" href ="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript">
function display_alert()
{
alert("Data Updated Successfully...!!!");
}
</script>
<body>
<button onclick="topFunction()" id="myBtn" title="Go to top">
<span class="glyphicon glyphicon-chevron-up"></span>
</button>
<script type="text/javascript">
window.onscroll = function()
{
scrollFunction()
};
function scrollFunction(){
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("myBtn").style.display = "block";
} else {
document.getElementById("myBtn").style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
<nav class="navbar navbar-inverse navbar-fixed-top navigation-clean-search" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">Le Cafe'</a>
</div>
<div class="collapse navbar-collapse " id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="aboutus.php">About</a></li>
<li><a href="contactus.php">Contact Us</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Welcome <?php echo $login_session; ?> </a></li>
<li class="active"> <a href="managerlogin.php">MANAGER CONTROL PANEL</a></li>
<li><a href="logout_m.php"><span class="glyphicon glyphicon-log-out"></span> Log Out </a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="jumbotron">
<h1>Hello Manager! </h1>
<p>Manage all your restaurant from here</p>
</div>
</div>
<div class="container">
<div class="container">
<div class="col">
</div>
</div>
<div class="col-xs-3" style="text-align: center;">
<div class="list-group">
<a href="myrestaurant.php" class="list-group-item ">My Restaurant</a>
<a href="view_food_items.php" class="list-group-item ">View Food Items</a>
<a href="add_food_items.php" class="list-group-item ">Add Food Items</a>
<a href="edit_food_items.php" class="list-group-item active">Edit Food Items</a>
<a href="delete_food_items.php" class="list-group-item ">Delete Food Items</a>
<a href="view_order_details.php" class="list-group-item ">View Order Details</a>
</div>
</div>
<div class="col-xs-3">
<div class="form-area" style="padding: 10px 10px 110px 10px; ">
<div style="text-align: center;">
<h3>Click On Menu <br><br></h3>
</div>
<?php
if (isset($_GET['submit'])) {
$F_ID = $_GET['dfid'];
$name = $_GET['dname'];
$price = $_GET['dprice'];
$description = $_GET['ddescription'];
$query = mysqli_query($conn, "UPDATE food set
name='$name', price='$price',
description='$description' where F_ID='$F_ID'");
}
$query = mysqli_query($conn, "SELECT * FROM food f WHERE f.R_ID IN (SELECT r.R_ID FROM RESTAURANTS r WHERE r.M_ID='$user_check') ORDER BY F_ID");
while ($row = mysqli_fetch_array($query)) {
?>
<div class="list-group" style="text-align: center;">
<?php
echo "<b><a href='edit_food_items.php?update= {$row['F_ID']}'>{$row['name']}</a></b>";
?>
</div>
<?php
}
?>
<?php
if (isset($_GET['update'])) {
$update = $_GET['update'];
$query1 = mysqli_query($conn, "SELECT * FROM food WHERE F_ID=$update");
while ($row1 = mysqli_fetch_array($query1)) {
?>
</div>
</div>
<div class="container">
<div class="col-md-6">
<div class="form-area" style="padding: 0px 100px 100px 100px;">
<form action="edit_food_items.php" method="GET">
<br style="clear: both">
<h3 style="margin-bottom: 25px; text-align: center; font-size: 30px;"> EDIT YOUR FOOD ITEMS HERE </h3>
<div class="form-group">
<input class='input' type='hidden' name="dfid" value=<?php echo $row1['F_ID']; ?> />
</div>
<div class="form-group">
<label for="username"><span class="text-danger" style="margin-right: 5px;">*</span> Food Name: </label>
<input type="text" class="form-control" id="dname" name="dname" value=<?php echo $row1['name']; ?> placeholder="Your Food name" required="">
</div>
<div class="form-group">
<label for="username"><span class="text-danger" style="margin-right: 5px;">*</span> Food Price: </label>
<input type="text" class="form-control" id="dprice" name="dprice" value=<?php echo $row1['price']; ?> placeholder="Your Food Price (INR)" required="">
</div>
<div class="form-group">
<label for="username"><span class="text-danger" style="margin-right: 5px;">*</span> Food Description: </label>
<input type="text" class="form-control" id="ddescription" name="ddescription" value=<?php echo $row1['description']; ?> placeholder="Your Food Description" required="">
</div>
<div class="form-group">
<button type="submit" id="submit" name="submit" class="btn btn-primary pull-right" onclick="display_alert()" value="Display alert box" > Update </button>
</div>
</form>
<?php
}
}
?>
</div>
</div>
<?php
mysqli_close($conn);
?>
</div>
</div>
</body>
<br>
</html>