harlequin2k5

08-02-2007, 04:27 AM

after searching for a mortgage calculator script and not liking what I found I decided it was high time to try to make my own - I don't need anything fancy...and I think I'm just being blind to what I'm missing - but nothing displays when I click on calculate

don't be too harsh if it's something dumb - I'm trying real hard to learn this stuff...:o

this is the form:

<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">

<p>Amount: <input type="text" name="amount" id="amount" /></p>

<p>Interest: <input type="text" name="interest" id="interest" /></p>

<p>Term: <input type="text" name="term" id="term" /></p>

<input type="submit" value="Calculate" name="calculate" />

</form>

this is what I'm trying to calculate:

<?php

//$amount=the total amount financed

//$interest=amount of interest to apply

//$percent=$interest/100

//$term=total years of loan

//$payment=(($amount*$percent)*$term)/($term*12)

$amount=$_POST['amount'];

$interest=$_POST['interest'];

$term=$_POST['term'];

if (isset($_GET['calculate']) && (floatval($amount) !=0) && (floatval($interest) !=0) && (floatval($term) !=0))

{

$percent=($interest/100);

$payment=(($amount*$percent)*$term)/($term*12);

echo "Monthly payment=$";

echo round($payment);

}

else

{

echo "Please complete all fields.";

}

?>

edit: they don't call me bimbo for nuttin *chuckles*...thanks for the catch fumi :)

don't be too harsh if it's something dumb - I'm trying real hard to learn this stuff...:o

this is the form:

<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">

<p>Amount: <input type="text" name="amount" id="amount" /></p>

<p>Interest: <input type="text" name="interest" id="interest" /></p>

<p>Term: <input type="text" name="term" id="term" /></p>

<input type="submit" value="Calculate" name="calculate" />

</form>

this is what I'm trying to calculate:

<?php

//$amount=the total amount financed

//$interest=amount of interest to apply

//$percent=$interest/100

//$term=total years of loan

//$payment=(($amount*$percent)*$term)/($term*12)

$amount=$_POST['amount'];

$interest=$_POST['interest'];

$term=$_POST['term'];

if (isset($_GET['calculate']) && (floatval($amount) !=0) && (floatval($interest) !=0) && (floatval($term) !=0))

{

$percent=($interest/100);

$payment=(($amount*$percent)*$term)/($term*12);

echo "Monthly payment=$";

echo round($payment);

}

else

{

echo "Please complete all fields.";

}

?>

edit: they don't call me bimbo for nuttin *chuckles*...thanks for the catch fumi :)