Showing posts with label php compound interest calculator. Show all posts
Showing posts with label php compound interest calculator. Show all posts

Thursday, March 12, 2015

Compound Interest Calculator in PHP

Here there in this article I would like to share with you a program that will help you compute the compounded interest in a loan you have made from a bank or financial institution. I called this program Compound Interest Calculator written entirely in PHP. What does our program will do is to ask the user the principle amount that is being loan by person, the number of years to be paid and the yearly interest rate for the said load. Every year it will be computed by our program for our user. This can be helpful for planning for the payment of the loan of the user in the future. I have a great time writing this program I hope this program will help you in your financial management.

If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360




Program Listing

<html>
<title> Compound Interest Calculator</title>
<style>
body { 
  font-size:20px; 
  font-family:arial;
  color:blue;
  } 
 label{
    display: table-cell;
    text-align: justify;
}
input {
  display: table-cell;
}
div.row{
    display:table-row;
}
</style>
<?php
error_reporting(0);

$amount   = $_POST['amount'];
$years    = $_POST['years'];
$interest = $_POST['interest'];

$amount2 = (float)$amount;
$rate2   = (float)$rate;


if(isset($_POST['check'])) {
$title .= " ===== GENERATED RESULT ===== " ."<BR><BR>";
 $title .= "Total amount componded over the " . $years. " year(s)."."<br><br>";
      for($x = 1; $x <= $years; $x++) {
          $amount3 = $amount2 * pow(1+ $interest, $x);
          $title .= "Year "  .$x. "  :=> $ ".number_format($amount3,2,'.',',')."<br>";
   }
  
       
}
if(isset($_POST['clear'])) {
  $amount = " ";
  $years = " ";
  $interest = " ";
  $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Compound Interest Calculator</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter Principle Amount $ : </label> <input type="text" name="amount" 
           value="<?php echo $amount; ?>" autofocus required size=10/><br> </div>
<div class="row"> <label> Enter Years of Payment  : </label><input type="text" name="years" 
           value="<?php echo $years; ?>" required size=10/><br> </div>
<div class="row"> <label> Enter Interest Rate    : </label> <input type="text" name="interest" 
           value="<?php echo $interest; ?>"  required size=10/> </div> </div>   
  <br>
   <input type="submit" name="check" value="Solve Compound Interest" 
  title="Click here to compute the compounded interest."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>
<br> 
<?php 
echo $title;
 ?>
  </body>
</html>