-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAaron_Ssite.php
98 lines (69 loc) · 2.01 KB
/
Aaron_Ssite.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<title></title>
<h1>Gas Cost Calculator</h1>
<hr>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="container">
<ol>
<li>Enter Miles Traveled</li>
<li>Enter your vehicle's Miles Per Gallon</li>
</ol>
<?php
if(isset($_POST['submit']))
{
if(is_numeric($_POST['number1']) && is_numeric($_POST['number2']))
{
}
if($_POST['operation'] == 'divided by')
{
$total = $_POST['number1'] / $_POST['number2'];
}
echo "<h1> Your Gallons Used is: {$total}</h1>";
} else {
echo 'Numeric values are required';
}
?>
<form method="post" action="site.php">
<input name="number1" type="text" class="form-control" style="width: 150px; display: inline" />
<select name="operation">
<option value="divided by">Divide</option>
</select>
<input name="number2" type="text" class="form-control" style="width: 150px; display: inline" />
<input name="submit" type="submit" value="Calculate" class="btn btn-primary" />
</form>
<ol>
<li>The calculated number from the previous equation</li>
<li>Enter the cost of gas per gallon on your trip</li>
</ol>
<?php
if(isset($_POST['submit']))
{
if(is_numeric($_POST['number1']) && is_numeric($_POST['number2']))
{
if($_POST['operation'] == 'multiply')
{
$total2 = $_POST['number1'] * $_POST['number2'];
}
echo "<h1> Your Total Amount Spent on Gas Is:$ {$total2}</h1>";
} else {
echo 'Numeric values are required';
}
}
?>
<form method="post" action="site.php">
<input name="number1" type="text" class="form-control" style="width: 150px; display: inline" />
<select name="operation">
<option value="multiply">Multiply</option>
</select>
<input name="number2" type="text" class="form-control" style="width: 150px; display: inline" />
<input name="submit" type="submit" value="Calculate" class="btn btn-primary" />
</form>
</div>
</body>
</html>