A simple math problem, but I can't get it working. If I enter 50 for $hours and 10 for $hourly I keep getting 400 $weekPay. It refuses to calculate OT pay. I don't understand what's wrong.
<?php
$name = $_POST['employeeName'];
$hours = $_POST['hoursWorked'];
$hourly = $_POST['hourlyPay'];
echo "<p>Week pay for $name \n</p>";
echo "<p>Hours worked: $hours \n</p>";
echo "<p>Pay rate: $hourly \n</p>";
if ($hours > 40)
{
$otHours = $hours - 40;
echo "<p>OT Hours: $otHours\n</p>";
$weekPay = (($hourly * 40) + (1.5 * hourly) * otHours);
}
else
$weekPay = $hours * $hourly;
echo "<p>Week pay: $weekPay </p>";
?>