require_once('../Include/system.inc'); $strTitle = "Mortgage Calculator"; $aMeta[desc] = "Mortgate Calculator"; $strArticleHeading = $strTitle; ?> include( '../Include/header.inc'); ob_start();?>
$form = ob_get_clean(); if($_REQUEST[action]) { ob_start(); if(!is_numeric($_POST[loanAmount]) || !is_numeric($_POST[interestRate]) || !is_numeric($_POST[years])) $error[] = "Please fill-up the required fields with appropriate values."; elseif((intval($_POST[years]) > 30) || (intval($_POST[years]) < 0)) $error[] = "Please make sure that the Amortization length is between 0 to 30."; elseif((intval($_POST[interestRate]) > 30) || (intval($_POST[interestRate]) < 1)) $error[] = "Please make sure that the Interest rate is between 0 to 30."; if(count($error)) { echo 'Year | Month | Beginning Balance | Principle Paid | Interest Paid | Ending Balance |
---|---|---|---|---|---|
$y | $m | " . number_format(round($balanceB, 2), 2) . " | " . number_format(round($principle_paid, 2), 2) . " | " . number_format(round($interest_paid, 2), 2) . " | " . number_format(round($balance, 2), 2) . " |
Year | Beginning Balance | Principle Paid | Interest Paid | Ending Balance |
---|---|---|---|---|
$y | " . number_format(round($balanceB, 2), 2) . " | " . number_format(round($principle_paid, 2), 2) . " | " . number_format(round($interest_paid, 2), 2) . " | " . number_format(round($balance, 2), 2) . " |