I have a simple loan calculator that I have developed. You put in a start date and a due date along with interest and principal. The calculator will tell you the start and due dates, interest rate, principle amount, with simple interest due and total amount required to repay. For the most part the calculator works. But when I put in a year date larger than 2037 the code will not work. I think I am missing something. If anyone has any suggestions please let me know.
Thanks,
r
Here is my code:
[php]
Simple Interest Loan | |
---|---|
Start Date: | "; echo date("F j, Y", $startdate); echo " | Due Date: | ";
echo date("F j, Y", $enddate);
//work out the dates differences
$dates = $enddate - $startdate;
$newdate = floor($dates / (365 *24 * 60 * 60));
//echo $newdate;
}else{
echo "Please make sure start date is less than end date";
}
}else{
echo " Please check years "; } echo " | ";
if(isset($_POST['interest']) && !empty($_POST['interest'])) {
$interest = $_POST['interest'];
//convert interest into decimal
$inter = $interest / 100;
echo "
Interest Rate: | ";
echo $inter."%";
}else{
echo " Please add the interest "; } echo " |
Principle Amount: | "; echo "$".number_format($principle, 2, '.',','); echo " |
Simple Interest Due: | "; echo "$".number_format($interestdue, 2, '.',','); echo " |
";
//total amount of loan to pay back
echo "The amount required to "; echo "repay the loan is: "; echo " |
";
echo "$".number_format($principle + $interestdue, 2,'.',',');
}else{
echo " Please add the principle "; } echo " |
[/php]