-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestauantask.html
76 lines (63 loc) · 2.47 KB
/
restauantask.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Online Order Form</title>
</head>
<body>
<h1>Order Online</h1>
<!-- Order Section -->
<h2>Order</h2>
<form id="orderForm">
<label for="item">Select an item:</label>
<select id="item" name="item">
<option value="pizza">Pizza</option>
<option value="burger">Burger</option>
<!-- Add more item options as needed. -->
</select><br>
<!-- Add more input fields for customizations, quantity, size, etc. -->
<label for="totalPrice">Total Price:</label>
<span id="totalPriceDisplay">$0.00</span><br>
</form>
<!-- Personal Details Section -->
<h2>Personal Details</h2>
<form id="personalDetailsForm">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br>
<label for="phone">Phone:</label>
<input type="tel" id="phone" name="phone" required><br>
</form>
<!-- Card Details Section -->
<h2>Card Details</h2>
<form id="cardDetailsForm">
<label for="cardNumber">Card Number:</label>
<input type="text" id="cardNumber" name="cardNumber" required><br>
<label for="expiryDate">Expiry Date:</label>
<input type="text" id="expiryDate" name="expiryDate" required><br>
<label for="cvv">CVV:</label>
<input type="text" id="cvv" name="cvv" required><br>
</form>
<!-- Submit Button -->
<button type="button" onclick="submitOrder()">Place Order</button>
<script>
// JavaScript code for handling form submission and computing total price
function submitOrder() {
// Gather form data and handle form submission to the server
// You would need to implement this part using a back-end server
console.log("Order submitted!");
}
// JavaScript code for computing the total price based on selected items
// You would need to implement this based on your actual pricing logic
// For this example, we'll just set a fixed price of $10 for any item selected
const itemSelect = document.getElementById("item");
const totalPriceDisplay = document.getElementById("totalPriceDisplay");
itemSelect.addEventListener("change", () => {
const selectedPrice = 10; // Replace this with actual pricing logic
totalPriceDisplay.textContent = "$" + selectedPrice.toFixed(2);
});
</script>
</body>
</html>