-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckout.php
335 lines (291 loc) · 15.6 KB
/
Checkout.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<?php
if (!isset($_SESSION)) {
session_start();
}
if ($_SESSION['valid_user'] != true) {
header('Location: index.php');
die();
}
include 'dbconnect.php';
$SId = $_SESSION['ID'];
$result = mysqli_query($conn, "SELECT * FROM register where ID='$SId'");
while ($row = mysqli_fetch_array($result)) {
$EId = $row['ID'];
$uName = $row['First_Name'];
$upic = $row['File'];
}
if (isset($_POST['order_btn'])) {
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$method = $_POST['method'];
$flat = $_POST['flat'];
$street = $_POST['street'];
$city = $_POST['city'];
$state = $_POST['state'];
$country = $_POST['country'];
$pin_code = $_POST['pin_code'];
$cart_query = mysqli_query($conn, "SELECT * FROM `cart`");
$price_total = 0;
if (mysqli_num_rows($cart_query) > 0) {
while ($product_item = mysqli_fetch_assoc($cart_query)) {
$product_name[] = $product_item['name'] ;
$product_price = $product_item['price'] * $product_item['quantity'];
$price_total += $product_price;
}
;
}
;
$total_product = implode(', ', $product_name);
$detail_query = mysqli_query($conn, "INSERT INTO `orders`(name, number, email, method, flat, street, city, state, country, pin_code, total_products, total_price,student_id) VALUES('$name','$number','$email','$method','$flat','$street','$city','$state','$country','$pin_code','$total_product','$price_total','$EId')") or die('query failed');
$sql = mysqli_query($conn, "DELETE FROM `cart` where student_id = '$EId'");
if ($cart_query && $detail_query && $sql) {
$_SESSION['message'] = "
<div style='width:70%; height:80%; margin:0 auto;'>
<div style='padding:10px;'>
<h1 class='text-center'><strong>Thank you for choosing us!</strong></h1>
<br><br><br><br>
<div class='text-center' style='font-size:1.3rem;'>
<span>" . $total_product . "</span><br>
<span class='total'> Total Price : $" . $price_total . "/- </span>
</div>
<div class='text-left' style='font-size:1.3rem;'>
<p> Name : <span>" . $name . "</span> </p>
<p> Number : <span>" . $number . "</span> </p>
<p> Email : <span>" . $email . "</span> </p>
<p> Address : <span>" . $flat . ", " . $street . ", " . $city . ", " . $state . ", " . $country
. " - " . $pin_code . "</span> </p>
<p> Your payment mode : <span>" . $method . "</span> </p>
</div>
<br><br><br>
<a href='Buy.php' class='btn btn-primary rounded-pill'>Buy More</a>
</div>
</div>
";
header("location: OrderConfirm.php");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/3a9eef0171.js" crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;900&family=Libre+Baskerville&family=Poppins:wght@200;500&display=swap"
rel="stylesheet">
<style>
.cbo {
min-width: 300px;
overflow: auto;
overflow-x: scroll;
white-space: nowrap;
}
.cbw {
width: 25%;
display: inline-block;
}
p {
font-family: 'Poppins', sans-serif;
}
h1,
h2,
h3 {
font-family: 'Playfair Display', serif;
}
</style>
<title>Learnfinity</title>
</head>
<body>
<nav class="navbar navbar-expand sticky-top" style="background-color:#A66CFF">
<div class="container-fluid">
<img src="Image/icon.png" alt="" style="width:1.5rem;">
<a class="navbar-brand" href="home.php">Learnfinity</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link " href="#Categories" role="button">
Categories
</a>
</li>
<li>
<form class="d-flex align-middle" role="search">
<input class="form-control ms-5 me-2 rounded-pill border-0" type="search"
placeholder="Search" aria-label="Search">
<button class="btn " type="submit"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
</li>
</ul>
<a class="navbar-brand">Welcome,
<?php echo $uName ?>
</a>
<a href="logout.php"><img src="Student_Image/<?php echo $upic ?>" alt=""
style="width:40px; border-radius: 100%;"></a>
</div>
</div>
</nav>
<section class="w-100 p-4 d-flex justify-content-center pb-4">
<div style="width: 26rem;">
<!-- Pills navs -->
<ul class="nav justify-content-center">
<li class="nav-item">
<button
class="tablinks shadow-sm btn bg-danger text-white rounded-4 pill btn-lg m-2 border-2"><strong>Fill
The Form To Complete the Order</strong></button>
</li>
</ul>
<!-- Pills navs -->
<!-- Pills content -->
<div class="tab-content">
<div class="tab-pane active tabcontent show" id="pills-register">
<form action="" method="post" enctype="multipart/form-data">
<!-- Name input -->
<div class="form-outline mb-4">
<input type="text" name="name" class="form-control">
<label class="form-label" style="margin-left: 0px;">Name</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 42.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<!-- Username input -->
<div class="form-outline mb-4">
<input type="text" name="number" class="form-control">
<label class="form-label" style="margin-left: 0px;">Mobile No</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<input type="email" id="registerEmail" name="email" class="form-control">
<label class="form-label" for="registerEmail" style="margin-left: 0px;">Email</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 40px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<!-- Username input -->
<div class="form-outline mb-4">
<input type="text" name="flat" class="form-control">
<label class="form-label" style="margin-left: 0px;">Address Line 1</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<!-- Username input -->
<div class="form-outline mb-4">
<input type="text" name="street" class="form-control">
<label class="form-label" style="margin-left: 0px;">Address Line 2</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<input type="text" name="city" class="form-control">
<label class="form-label" style="margin-left: 0px;">City</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<input type="text" name="state" class="form-control">
<label class="form-label" style="margin-left: 0px;">State</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<input type="text" name="country" class="form-control">
<label class="form-label" style="margin-left: 0px;">Country</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<input type="text" name="pin_code" class="form-control">
<label class="form-label" style="margin-left: 0px;">Pin Code</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<div class="form-outline mb-4">
<select class="form-select" name="method" aria-label="Default select example">
<option selected>Choose method of payment</option>
<option value="Card">Card</option>
<option value="Net Banking">Online Banking</option>
<option value="UPI">UPI</option>
</select>
<label class="form-label" style="margin-left: 0px;">Payment</label>
<div class="form-notch">
<div class="form-notch-leading" style="width: 9px;"></div>
<div class="form-notch-middle" style="width: 66.4px;"></div>
<div class="form-notch-trailing"></div>
</div>
</div>
<!-- Submit button -->
<button type="submit" name="order_btn" class="btn btn-danger btn-block mt-5">Order Now</button>
</form>
</div>
</div>
<!-- Pills content -->
</div>
</section>
<div class="container">
<UL class="nav col-md justify-content-center list-unstyled d-flex">
<li class="ms-5"><a href="ContactUs.php" class="text-muted text-decoration-none">Contact Us</a></li>
<li class="ms-5"><a href="AboutUs.php" class="text-muted text-decoration-none">About Us</a></li>
<li class="ms-5"><a href="TermsAndConditions.php" class="text-muted text-decoration-none">Terms &
Condition</a></li>
</UL>
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-center">
<a href="/" class="mb-3 me-2 mb-md-0 text-muted text-decoration-none lh-1">
<svg class="bi" width="30" height="24">
<use xlink:href="#bootstrap"></use>
</svg>
</a>
<span class="text-muted">© Learnfinity 2023 Company, Inc</span>
</div>
<ul class="nav col-md justify-content-center list-unstyled d-flex">
<li class="ms-5"><a href="AdminLogin.php" class="text-muted text-decoration-none">Admin Login</a></li>
</ul>
<ul class="nav col-md-4 justify-content-end list-unstyled d-flex">
<li class="ms-3"><a class="text-muted" href="https://www.instagram.com/kanha.dehury.20/"><i class="fa-brands fa-instagram"></i></a></li>
<li class="ms-3"><a class="text-muted" href="https://twitter.com/kanha_dehury"><i class="fa-brands fa-twitter"></i></a></li>
<li class="ms-3"><a class="text-muted" href="https://www.linkedin.com/in/kanha-dehury-a3b7301b5/"><i class="fa-brands fa-linkedin"></i></a></li>
</ul>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
</body>
</html>