Question: help me fix my php file, i cant get a functioning output. here are the instructions: Make a form that gets two values from the

help me fix my php file, i cant get a functioning output. here are the instructions:

Make a form that gets two values from the user. You may use a text box for that. one for #of hours working and one for an hourly rate. (HTML form)

Add a condition to your function . If the number of hours exceeds 40 hours then assign a 5% bonus to the wage, if it's between 30-40 assign 3% bonus to the wage.

Write a PHP function that gets two variables the number of hours worked and hourly wage. Calculate the wage and return it

Do the function call and print a message saying that " ...... is your wage". Also make the form sticky.

Heres the php file:

function calculateWage($hours, $wage) { $wage = $hours * $wage; if ($hours > 40) { $bonus = $wage * 0.05; } elseif ($hours >= 30 && $hours <= 40) { $bonus = $wage * 0.03; } else { $bonus = 0; } return $wage + $bonus; }

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$hours = $_POST['hours'];

$wage = $_POST['wage'];

$wage = calculateWage($hours, $wage);

echo "Your wage is: $" . number_format($wage, 2);

$hours = isset($_POST['hours']) ? htmlspecialchars($_POST['hours']) : '';

$wage = isset($_POST['wage']) ? htmlspecialchars($_POST['wage']) : '';

} else {

$hours = '';

$wage = '';

}

?>

">

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!