-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
51 lines (41 loc) · 1.35 KB
/
Copy pathprocess.php
File metadata and controls
51 lines (41 loc) · 1.35 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Ice Cream Order Summary</title>
</head>
<body>
<h1>Thank you for your order!</h1>
<?php
// Turn on error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
// Define constants
define('PRICE_PER_SCOOP', 2.50);
define('SALES_TAX_RATE', 0.11);
// For testing purposes only
echo "<pre>";
var_dump($_POST);
echo"</pre>";
// Get data from POST array
$scoops = $_POST['scoops'];
$flavors = $_POST['flavor'];
$flavorString = implode(", ", $flavors);
$cone = $_POST['cone'];
// Calculate total due
$subtotal = PRICE_PER_SCOOP * $scoops;
$tax = $subtotal * SALES_TAX_RATE;
$total = $subtotal + $tax;
// Print a summary
echo "<p>$scoops scoops</p>";
echo "<p>Flavors: $flavorString</p>";
echo "<p>Cone: $cone</p>";
echo "<p>Subtotal: $$subtotal</p>";
echo "<p>Tax: $tax</p>";
echo "<p>Total: $$total</p>";
?>
</body>
</html>