Okay so here's my code:
function payCalc($hours, $wage, $overtime, $paycheck) {
if ($hours <= 40) {
$paycheck = $hours * $wage;
}
else {
$paycheck = $hours * $overtime;
}
return $paycheck;
}
$name = $_POST['name'];
$dept = $_POST['dept'];
$hours = $_POST['hours'];
$wage = $_POST['wage'];
$paycheck = payCalc($hours, $wage, $overtime, $paycheck);
$overTime = $wage * 1.5;
print "Your paycheck for this period is:";
print $paycheck;
print ".";
The problem is I keep getting undefined variable errors on $paycheck. As far as I know, I have the if/else set up properly, but it's not returning $paycheck. Which means that on the "print $paycheck;" line, it's not able to print. What am I missing?
EDIT: There IS more to this, but it's just echo lines to spit out the $name and $dept variables.
payCalc()function anywhere?