Hi all. I'm having an issue that I CAN NOT figure out for the life of me.
The program is to get user input about there paycheck , then calculate the answer.
What my problem is I can not get the php part to print anything inside the <?php?> tags. Not even a simple echo statement of my name will print out of I wipe the code and go from there. So maybe someone can see whats going on here and help me out.
Here's my code for the form:
<!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</title>
<meta http-equiv="content-type"
content="txt/html; charset=iso-8859-1" />
</head>
<body>
<h1>Paycheck Calculation</h1>
<p>Please enter the hours you worked and your hourly wage in the appropriate text boxes. Then click
the calculate button at the bottom to see how much you will make this week.</p>
<form action="Paycheck.php" method="get">
<p><b>Please enter the number of hours you worked this week including overtime.</b></p>
<input type="text" name="hoursWorked" size="15" maxlength="5" id="hours"/>
<p><b>Please enter your hourly wage.</b></p>
<input type="text" name="hourlyWage" size="15" maxlength="5" id="wage"/>
<p><input type="reset" id="reset" value="Reset" /></p>
<p><input type="submit" id="grossPay" value="Calculate" /></p>
</form>
</body>
</html>
Heres my code for the script:
<!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</title>
<meta http-equiv="content-type"
content="txt/html; charset=iso-8859-1" />
</head>
<body>
<h1>Paycheck Results</h1>
<?php
/*
Shawn Houston
02/20/2010
*/
$hoursWorked = $_GET["hoursWorked"];
$hourlyWage = $_GET["hourlyWage"];
$hours = $hoursWorked;
$wage = $hourlyWage;
$pay = $grossPay;
if ($hours <= 40) {
$submit = ("$hours * $wage = $pay");
echo "Your gross pay is: $pay";
}
else
$submit = ("($hours * $wage) + (($hours - 40) * ($wage * 1.5)) = $pay");
echo "Your gross pay is: $pay";
?>
</body>
</html>
I have no idea whats going on here. Never ran into this before up until this point, and until then I can't even get my code cleaned up because I have no idea if anything is wrong.