I am very new to PHP. Right now we are working with functions and control structures. I have an assignment where I have to calculate earnings based on wage, hours, and potential overtime over 40 hours at 1.5.

There are no examples in my text at this point that I can follow from for direction and at this point I am going blind.

Can someone please provide assistance or direction on what I should be doing? As of now, all I am getting are errors.

paycheck.html code:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Paycheck Calculator</title>
<meta http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1" />
</head>
<body>
	<table>
    <tr>
    </tr>
    <tr>
        <td><h1>Paycheck Calculator</h1></td>
    </tr>
    <tr>


</tr>
</table>
<hr />

<form method="get" action="Paycheck.php">
    <p>Hours worked:
    <input type="text" name="hours" id="hours" />
    </p>
    <p>Employee wage:
    <input type="text" name="wage" id="wage" /><br /><br />
    <input type="submit" />
    </p>

</form>
</body>
</html>

paycheck.php code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Paycheck Results</title>
<meta http-equiv="Content-Type"
	content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="php_styles.css" type="text/css" />
</head>
<body>
<h1>Paycheck Calculations</h1>
<?php
/* Performed by Karan MacDonald
   Performed on October 4, 2009
   Introduction to understanding variable scopes 
   using Paycheck.html and Paycheck.php
*/
$hoursWorked = $_GET["hours"];
$wages = $_GET["wage"];
$x = $hoursWorked;
$y = $wages;
$z = $pay;

if ($x is <= 40){
$submit = ("$z = $x * $y")
echo "Your Paycheck is: $payCheck";
}

if ($x is > 40){
$submit = ("$z = ($x *$y) + (($x - 40) * $y * 1.5")
echo "Your Paycheck is: $payCheck";
}

?>
</body>
</html>

Any assistance would be greatly appreciated.

    Write a Reply...