| Posted by wayne on 06/26/74 11:40 
samudasu wrote:> 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 />';
 >
 
 Thank you for your help. I deleted the line and now it works. Now I just
 have some clean up to do in the html part and a couple more logic errors
 to fix and the form should be useful!
 
 --
 Wayne
 http://www.glenmeadows.com
 [Back to original message] |