It is a little choppy right now..my first bit of code I wrote 🙂
html>>>>>>>>>>>>>>>>>>>>>>>
<form action="/your directory/interest.php" method="get" name="Interest Rate" target="_self">
<table width="70%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr bgcolor="#000099">
<td colspan="5" ><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><strong>Compute
My Monthly Car Payments</strong></font></div></td>
</tr>
<tr>
<td width="7%" > </td>
<td width="32%" ><font size="2" face="Arial, Helvetica, sans-serif">Amount
Borrowed <font size="1">(do not put in $ or decimals)</font></font></td>
<td width="10%" ><strong>$</strong></td>
<td width="29%" scope="col"><div align="left">
<input name="prin" type="text" id="prin" maxlength="6">
</div></td>
<td width="22%" scope="col">.<strong>00</strong></td>
</tr>
<tr>
<td width="7%"> </td>
<td width="32%"><font size="2" face="Arial, Helvetica, sans-serif">Interest
Rate <font size="1">(eg. .07 is 7% )</font></font></td>
<td width="10%"> </td>
<td><div align="left">
<input name="int_rate" type="text" id="int_rate" maxlength="4">
</div></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><font size="2" face="Arial, Helvetica, sans-serif"> Payments per year
<font size="1">(eg. 12)</font></font></td>
<td> </td>
<td><input name="payments_year" type="text" id="num_payments2" maxlength="2"></td>
<td> </td>
</tr>
<tr>
<td width="7%"> </td>
<td width="32%"><font size="2" face="Arial, Helvetica, sans-serif">Number
of years <font size="1">(eg 5)</font></font></td>
<td width="10%"> </td>
<td><div align="left">
<input name="num_years" type="text" id="num_payments3" maxlength="2">
</div></td>
<td> </td>
</tr>
<tr bgcolor="#CCCCCC">
<td colspan="3" height="23"><div align="left"></div></td>
<td height="23"> </td>
<td height="23"> </td>
</tr>
<tr>
<td colspan="3"> </td>
<td><div align="left"> </div>
<div align="center">
<input type="submit" name="Submit" value="Compute ">
</div></td>
<td> </td>
</tr>
</table>
</form>
###############end of html ##############
<?php
// echo the results.....
printf( "Principle amount borrowed :<b>\$%.2f</b><br>",$prin);
echo ( "Interest Rate: <b>$int_rate</b><br>");
echo ("Payments per year : <b>$payments_year</b><br>");
echo ( "Length of Loan in Years : <b>$num_years</b><br><br><br>");
// formula
// M = Pi/[q(1-[1+(i/q)]-nq)],
// this is a basic amortization formula
// M = monthly payment,
//P= principle borrowed
//i = interest rate
//q = number of payements per year
//n = number of years the loan is taken out for
$temp = (1 + ($int_rate / $payments_year)); // deal with inner most function first
$exp = ($num_years $payments_year -1);// deal with x raised to power of y
$temp = pow($temp, $exp); // compute the results
$temp = (1- $temp );// continue to compute results ..
$temp = $temp $payments_year;//deal with main part of function everything in main [] brackets
$pi = $prin $int_rate;// deal with Pi part
$result = ($pi / $temp);// do the final calculation
printf ("Your monthly payment based on an amount borrowed of <b>\$ %.2f </b>
and with an interest rate of <b> %.2f percent </b><br>
your monthly payments will be <b>\$%.2f .</b><br><br>", $prin,$int_rate,$result);
$total_int = $result ($num_years $payments_year) - $prin;
printf ("Your total amount in interest payments over the term of the loan is <b>\$%.2f</b>",
$total_int);
?>
#############end of php #####################
I wil keep pluggin away at it ... There are a few things I will change ...but at least I have the basic foundation ..
If you would like to offer susggestion that would be great...
PHP Mysql Rules