Posted by samudasu on 09/28/39 11:40
Ok, i see your problem now. This line "$total_downpayment = '$' .
num_format($total_downpayment); " is causing the problem. What it's
doing is setting total downpayment into a string that looks like
$20,000. Well you can't subtract a number (string) formatted as
$20,000 from a number that looks like 200000. PHP will normally let you
subtract one string from another but the comma and dollar sign are
throwing it off. This will work:
if ($_SESSION['nickname'] == '') {
$_SESSION['nickname'] = 'My Future Home';
}
if ($total_downpayment < 0) {
$total_downpayment = 'You have less than what is needed to pay initial
costs.';
}
print 'Your down payment will be: <strong>$' .
num_format($total_downpayment) . '</strong>
(' . num_format($percentage_down*100) . '%)<br />
Your loan amount will be: <strong>$' .
num_format($_SESSION['house_cost'] - $total_downpayment) .
'</strong><br /><br />';
Navigation:
[Reply to this message]
|