-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder_confirmation.php
More file actions
61 lines (52 loc) · 1.69 KB
/
order_confirmation.php
File metadata and controls
61 lines (52 loc) · 1.69 KB
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
<?php
session_start();
include('config.php');
// Ensure user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit();
}
$user_id = $_SESSION['user_id'];
// Verify order_id is provided
if (!isset($_GET['order_id'])) {
header("Location: order_history.php");
exit();
}
$order_id = $_GET['order_id'];
// Fetch order details
$sql = "SELECT * FROM orders WHERE id='$order_id' AND user_id='$user_id'";
$result = mysqli_query($conn, $sql);
$order = mysqli_fetch_assoc($result);
if (!$order) {
header("Location: order_history.php");
exit();
}
// Confirm order receipt
if (isset($_POST['confirm_receipt'])) {
header("Location: order_confirmed.php?order_id=" . $order_id);
exit();
}
mysqli_close($conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Confirm Order - Honey E-Commerce</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2>Confirm Order Receipt</h2>
<p>Order Date: <?php echo htmlspecialchars($order['order_date']); ?></p>
<p>Total Amount: $<?php echo number_format($order['total_amount'], 2); ?></p>
<p>Status: <?php echo htmlspecialchars($order['status']); ?></p>
<p>Delivery Taken: <?php echo htmlspecialchars($order['delivery_taken_at'] ?? 'Not yet'); ?></p>
<form method="POST">
<button type="submit" name="confirm_receipt" class="btn btn-success">Confirm Receipt</button>
<a href="order_history.php" class="btn btn-secondary">Back</a>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>