-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem2.php
More file actions
48 lines (48 loc) · 1.26 KB
/
problem2.php
File metadata and controls
48 lines (48 loc) · 1.26 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
<style>
table,
th,
td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
<h3>Problem 2</h3>
<?php
if ($_POST) {
if (!isset($_POST['category'])) {
echo "please select the Vehicle <a href='index.html'>Back</a>";
exit;
} else {
if ($_POST['category'] == "car") {
$rate = 20;
} else if ($_POST['category'] == "suv") {
$rate = 40;
} else {
$rate = 50;
}
}
if (!isset($_POST['coverage'])) {
$coverage = 0;
} else {
$coverage = 20;
}
$total = $_POST['numDays'] * $rate + $coverage;
echo "<table>
<tr>
<th>Vehicle Category</th>
<th>Number Of Day</th>
<th>Rate Per Day ($)</th>
<th>Coverage Price($)</th>
<th>Total</th>
</tr>
<tr>
<th>" . ucwords($_POST['category']) . "</th>
<th>{$_POST['numDays']}</th>
<th>$" . $rate . "</th>
<th>$" . $coverage . "</th>
<th><b>$" . $total . "</b></th>
</tr>
</table><br><a href='index.html'>Back</a>";
} else {
echo "wrong page <a href='index.html'>Back</a>";
}