I'm not sure. Your script works for me. Is there something in the
script that might unset $total_downpayment? See what happens if you set
$temp = $total_downpayment and then change
num_format($_SESSION['house_cost'] - $total_downpayment)
to
num_format($_SESSION['house_cost'] - $temp)