I'm having a hell of a time creating a PHP calculator for my work's website for a special needs transportation service (shuttle buses) I have the HTML and PHP set up, but I can't seem to get it to work.
These are what i need to figure out how to make the PHP do, so I can put it on the services page. I can't seem to get it right.
Constant rate: $50 for 30min of Trans Additional Set cost: 5% taxed on
Here's the HTML
<form method="get" action="calculationtable.php">
<p>Time Traveled:
<input type="text" name="hours" id="hours" />
</p>
<p>Transport Rate ($100/1hr):
<input type="text" name="rate" id="rate" /><br /><br />
<input type="submit" />
</p>
</form>
and the PHP
<?php
$hours = (int) $_GET["hours"];
$rate = (int) $_GET["rate"];
$overtime = max($hours - 40, 0);
$pay += $overtime * $rate * 1.5;
$pay += ($hours - $overtime) * $rate;
echo "Hours Traveled: " . $hours . "<br>";
echo "Transport rate (per hour): $" . number_format($rate, 2) . "<br>";
echo "Additional Hours: " . $overtime . "<br>";
echo "Your Total is: $" . number_format($pay, 2) . "<br>";
?>