-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin_tours_edit.php
237 lines (216 loc) · 14.6 KB
/
admin_tours_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
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
226
227
228
229
230
231
232
233
234
235
236
237
<?php
include 'config.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>E-Tour</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel='stylesheet' type='text/css' media='screen' href='css/style.css'>
</head>
<body>
<div class="row justify-content-center m-0">
<div class="col-sm-2 bg-dark text-light text-center sticky-top" style="height: 100vh;">
<h3 class="p-4">Admin <br> Panel</h3>
<hr>
<div class="list-group">
<a href="admin_panel.php" class="btn btn-dark p-3 text-start" aria-current="true">Dashboard</a>
<a href="admin_users.php" class="btn btn-dark p-3 text-start">Users</a>
<a href="admin_tours.php" class="btn btn-light m-3 text-start">Tours</a>
<a href="admin_bookings.php" class="btn btn-dark p-3 text-start">Bookings</a>
<a href="admin_inbox.php" class="btn btn-dark p-3 text-start">Inbox</a>
<hr>
<a href="index.php" class="btn btn-dark text-start">Back to site</a>
</div>
</div>
<div class="col-sm-10 bg-light text-dark p-5">
<h2>Edit Tour</h2>
<?php if (isset($_GET['error0'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error0']; ?></p>
<?php endif ?>
<?php
if (isset($_GET['id'])) {
// echo $_GET['id'];
$tourId = mysqli_real_escape_string($conn, $_GET['id']);
$sql = "SELECT * FROM Tours WHERE id = '$tourId'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$tour = mysqli_fetch_array($result);
?>
<form action="upload.php" method="POST" enctype="multipart/form-data" class="row g-4 mt-4">
<input type="hidden" name="tour_id" value="<?= $tour['id']; ?>">
<div class="col-md-12">
<label for="inputEmail4" class="form-label">title <span class="text-danger">*</span></label>
<input type="text" class="form-control" value="<?= $tour['title']; ?>" placeholder="" name="title" required>
</div>
<div class="col-md-12">
<label for="imgTitle" class="form-label">title_img (Image Dimentions : 450 * 300) <span class="text-danger">* </label>
<input type="file" name="title_img" class="form-control">
<?php if (isset($_GET['error'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error']; ?></p>
<?php endif ?>
</div>
<div class="col-md-4">
<label for="inputEmail4" class="form-label">price <span class="text-danger">*</label>
<input type="number" class="form-control" value="<?= $tour['price']; ?>" placeholder="" name="price" required>
</div>
<div class="col-md-4">
<label for="" class="form-label">destination <span class="text-danger">*</label>
<select class="form-control" name="destination" id="destinations">
<?php
$sql = "SELECT * FROM Destinations";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo "SQL statement failed";
} else {
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result)) {
echo '
<option>' . $row["name"] . '</option>
';
}
}
?>
</select>
</div>
<div class="col-md-4">
<label for="duration" class="form-label">duration <span class="text-danger">*</label>
<input type="number" class="form-control" value="<?= $tour['duration']; ?>" placeholder="duration" name="duration" required>
</div>
<div class="col-md-12">
<label for="overview" class="form-label">overview <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['overview']; ?>" placeholder="" name="overview" required>
</div>
<div class="col-md-12">
<label for="highlights_1" class="form-label">highlights_1 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['highlights_1']; ?>" placeholder="" name="highlights_1" required>
</div>
<div class="col-md-12">
<label for="highlights_2" class="form-label">highlights_2</label>
<input type="text" class="form-control" value="<?= $tour['highlights_2']; ?>" placeholder="" name="highlights_2">
</div>
<div class="col-md-12">
<label for="highlights_3" class="form-label">highlights_3</label>
<input type="text" class="form-control" value="<?= $tour['highlights_3']; ?>" placeholder="" name="highlights_3">
</div>
<div class="col-md-12">
<label for="inputPassword4" class="form-label">image_1 (Image Dimentions : 2 * 1) <span class="text-danger">*</label>
<input type="file" name="image_1" value="<? $tour['title']; ?>" class="form-control">
<?php if (isset($_GET['error1'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error1']; ?></p>
<?php endif ?>
</div>
<div class="col-md-12">
<label for="inputPassword4" class="form-label">image_2 (Image Dimentions : 2 * 1) <span class="text-danger">*</label>
<input type="file" name="image_2" value="<? $tour['title']; ?>" class="form-control">
<?php if (isset($_GET['error2'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error2']; ?></p>
<?php endif ?>
</div>
<div class="col-md-12">
<label for="inputPassword4" class="form-label">image_3 (Image Dimentions : 2 * 1) </label>
<input type="file" name="image_3" value="<? $tour['title']; ?>" class="form-control">
<?php if (isset($_GET['error3'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error3']; ?></p>
<?php endif ?>
</div>
<div class="col-md-12">
<label for="inputPassword4" class="form-label">image_4 (Image Dimentions : 2 * 1) </label>
<input type="file" name="image_4" value="<? $tour['title']; ?>" class="form-control">
<?php if (isset($_GET['error4'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error4']; ?></p>
<?php endif ?>
</div>
<div class="col-md-12">
<label for="inputPassword4" class="form-label">image_5 (Image Dimentions : 2 * 1) </label>
<input type="file" name="image_5" value="<? $tour['title']; ?>" class="form-control">
<?php if (isset($_GET['error5'])) : ?>
<p class="text-danger pt-1"><?php echo $_GET['error5']; ?></p>
<?php endif ?>
</div>
<div class="col-md-12">
<label for="itn_day1" class="form-label">itn_day1 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['itn_day1']; ?>" placeholder="" name="itn_day1" required>
</div>
<div class="col-md-12">
<label for="itn_day2" class="form-label">itn_day2 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['itn_day2']; ?>" placeholder="" name="itn_day2" required>
</div>
<div class="col-md-12">
<label for="itn_day3" class="form-label">itn_day3</label>
<input type="text" class="form-control" value="<?= $tour['itn_day3']; ?>" placeholder="" name="itn_day3">
</div>
<div class="col-md-12">
<label for="itn_day4" class="form-label">itn_day4</label>
<input type="text" class="form-control" value="<?= $tour['itn_day4']; ?>" placeholder="" name="itn_day4">
</div>
<div class="col-md-12">
<label for="itn_day5" class="form-label">itn_day5</label>
<input type="text" class="form-control" value="<?= $tour['itn_day5']; ?>" placeholder="" name="itn_day5">
</div>
<div class="col-md-6">
<label for="included_1" class="form-label">included_1 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['included_1']; ?>" placeholder="" name="included_1" required>
</div>
<div class="col-md-6">
<label for="excluded_1" class="form-label">excluded_1 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['excluded_1']; ?>" placeholder="" name="excluded_1" required>
</div>
<div class="col-md-6">
<label for="included_2" class="form-label">included_2</label>
<input type="text" class="form-control" value="<?= $tour['included_2']; ?>" placeholder="" name="included_2">
</div>
<div class="col-md-6">
<label for="excluded_2" class="form-label">excluded_2</label>
<input type="text" class="form-control" value="<?= $tour['excluded_2']; ?>" placeholder="" name="excluded_2">
</div>
<div class="col-md-6">
<label for="included_3" class="form-label">included_3</label>
<input type="text" class="form-control" value="<?= $tour['included_3']; ?>" placeholder="" name="included_3">
</div>
<div class="col-md-6">
<label for="excluded_3" class="form-label">excluded_3</label>
<input type="text" class="form-control" value="<?= $tour['excluded_3']; ?>" placeholder="" name="excluded_3">
</div>
<div class="col-md-6">
<label for="location" class="form-label">location <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['location']; ?>" placeholder="" name="location" required>
</div>
<div class="col-md-12">
<label for="faq_1" class="form-label">faq_1 <span class="text-danger">*</label>
<input type="text" class="form-control" value="<?= $tour['faq_1']; ?>" placeholder="" name="faq_1" required>
</div>
<div class="col-md-12">
<label for="faq_2" class="form-label">faq_2</label>
<input type="text" class="form-control" value="<?= $tour['faq_2']; ?>" placeholder="" name="faq_2">
</div>
<div class="col-md-12">
<label for="faq_3" class="form-label">faq_3</label>
<input type="text" class="form-control" value="<?= $tour['faq_3']; ?>" placeholder="" name="faq_3">
</div>
<div class="col-md-6">
<label for="ratings" class="form-label">ratings <span class="text-danger">*</label>
<input type="number" min="0" max="5" value="<?= $tour['ratings']; ?>" class="form-control" placeholder="" name="ratings" required>
</div>
<!-- <div class="col-md-12">
<label for="exampleFormControlTextarea1" class="form-label">Special Requirements</label>
<textarea class="form-control" name="exampleFormControlTextarea1" placeholder="Special Requirements" rows="4"></textarea>
</div> -->
<div class="col-12">
<button name="update" class="btn btn-danger px-5">Update</button>
</div>
</form>
<?php
}
}
?>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>