I want a page that calculates a monthly payment. For grins I am just asking for the Cost of the house and the number of years.
When the user hits a calculate button I call a function that calculates the monthly payment.
I then want to link to the same page I am on and show the monthly payment. The user would never now he left the first web page.
Here is the code: Any ldeas? I just get a "error on the page" error.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<form name="form1" method="post" action="TestForm.php">
<?
Function calcMonthlyPayment()
{
Global $MonthlyPayment,$CostOfHouse,$Years;
$MonthlyPayment = $CostOfHouse / ($Years * 12);
header("Location: http://localhost/bookersrealty/TestForm.php");
exit;
// return($MonthlyPayment);
}
?>
<body>
<br>
<br>
<?
If (Isset($CostOfHouse))
{
echo "Cost of the house:" . $CostOfHouse;
}
?>
<?
If (Isset($Years))
{
echo "Number Of Years:" . $Years;
}
?>
<?
If (Isset($MonthlyPayment))
{
echo "Monthly Payment:" . $MonthlyPayment;
} else {
echo "Monthly Payment is not set";
}
?>
<br>
<br>
Cost Of The House:
<input name="CostOfHouse" type="text">
<br>
<br>
Number Of Years:
<input name="Years" type="text">
<br>
<br>
Monthly Payment:
<input name="MonthlyPayment" type="text">
<br>
<br>
<?
// <input type="submit" name="Submit" value="Submit">
?>
<input onclick="calcMonthlyPayment()" type="button" value="Calculate" name="button">
</form>
</body>
</html>