...possible.? this is the html code to get your number of hours worked and your payrate
<html>
<head>
<title>PHP Lab 10</title>
</head>
<body>
<form action="paycheck.php" method="post">
Number of hours worked: <input type="text" name="hoursworked" />
Hourly Wage: <input type="text" name="hourlywage" />
<input type="submit" />
</form>
</body>
</html>
and this is the php code to process it:
<html>
<head>
<title>PHP Lab 10
<body>
<?php
$overtime = 1.5;
$hourworked = $_POST["hoursworked"];
$hourlywage = $_POST["hourlywage"];
if ( $hoursworked < 41 ) {
$totalpay = $hoursworked * $hourlywage;
echo $totalpay;
}
else
$overtimehours = $hoursworked - 40;
$overtimepay = $overtimehours * ($hourlywage * $overtime);
$totalpay = $hoursworked * $hourlywage;
$finaltotal = $overtimepay + $totalpay;
echo $finaltotal;
?>
</body>
</html>
What am i doing wrong?
<html>
<head>
<title>PHP Lab 10</title>
</head>
<body>
<form action="paycheck.php" method="post">
Number of hours worked: <input type="text" name="hoursworked" />
Hourly Wage: <input type="text" name="hourlywage" />
<input type="submit" />
</form>
</body>
</html>
and this is the php code to process it:
<html>
<head>
<title>PHP Lab 10
<body>
<?php
$overtime = 1.5;
$hourworked = $_POST["hoursworked"];
$hourlywage = $_POST["hourlywage"];
if ( $hoursworked < 41 ) {
$totalpay = $hoursworked * $hourlywage;
echo $totalpay;
}
else
$overtimehours = $hoursworked - 40;
$overtimepay = $overtimehours * ($hourlywage * $overtime);
$totalpay = $hoursworked * $hourlywage;
$finaltotal = $overtimepay + $totalpay;
echo $finaltotal;
?>
</body>
</html>
What am i doing wrong?