-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathorder.php
More file actions
71 lines (62 loc) · 1.79 KB
/
order.php
File metadata and controls
71 lines (62 loc) · 1.79 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
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order Summary</title>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$database = "myshop";
//create connection
$conn = mysqli_connect($servername,$username,$password,$database);
//Check connection
if(!$conn){
die("Connection failed: ".mysqli_connect_error());
}
// Get the submitted form data
$customerName = $_POST['customer-name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$category = $_POST['category'];
$items = $_POST['items'];
// $quantities = $_POST['quantity'];
$additionalNotes = $_POST['additional-notes'];
// Fixed prices for each item
// $itemPrices = array(
// "Americano (8 oz)" => 69.00,
// "Vanilla Hot (12 oz)" => 69.00,
// "Vanilla Cold Brew (16 oz)" => 100.00,
// // Add more items and prices here for other categories
// );
// Calculate the total price
// $totalPrice = 0;
// for ($i = 0; $i < count($items); $i++) {
// $item = $items[$i];
// $quantity = $quantities[$i];
// $price = $itemPrices[$item];
// $totalPrice += $price * $quantity;
// }
// Display the order summary
echo "Order Summary:<br>";
echo "Customer Name: " . $customerName . "<br>";
echo "Phone: " . $phone . "<br>";
echo "Email: " . $email . "<br>";
echo "Category: " . $category . "<br>";
echo "Items:<br>";
for ($i = 0; $i < count($items); $i++) {
$item = $items[$i];
// $quantity = $quantities[$i];
// $price = $itemPrices[$item];
echo $item . "<br>";
// echo $item . " - Quantity: " . $quantity . " - Price: $" . $price . "<br>";
}
echo "Total Price: $" . $totalPrice . "<br>";
echo "Additional Notes: " . $additionalNotes;
?>
</body>
</html>