Showing posts with label simple interest solver in php. Show all posts
Showing posts with label simple interest solver in php. Show all posts

Thursday, November 26, 2015

Simple Interest Solver in PHP

A simple program that I wrote in PHP to compute the interest rate of a loan of a customer or client. The code is very simple and easy to understand good for beginners in PHP programming.

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

My mobile number here in the Philippines is 09173084360.


Sample Program Output


Program Listing

<?php

  error_reporting(0);

$principle = $_POST['principle'];
$rate = $_POST['rate'];
$time = $_POST['time'];


 if ($_POST['clear'])
   {
   $principle = "";
   $rate = "";
   $time = "";
   $display_results = "";
}


  if  ($_POST['compute']) 
  {
   $interest =($principle*$rate*$time)/100;
   $display_results = round($interest,2);
 }

?>
<html>
 <style>
 body {
  font-family:arial;
  font-size:12;
  }
</style>   
<title> Simple Interest Solver in PHP</title>
<form action = "" method = "POST">
<body>
<h2> Simple Interest Solver in PHP </h2>
<br>
<table border = 3>
<tr>
   <td> Principle Amount : </td>
   <td> <input type = text name = "principle" value = "<?php echo $principle;?>"  size="10" autofocus>
   </tr>
   <tr>
   <td> Rate of Interest : </td>
   <td> <input type = text name = "rate" value = "<?php echo $rate;?>"  size="5">
   </tr>
   <tr>
   <td> Time Period : </td>
   <td> <input type = text name = "time" value = "<?php echo $time;?>" size="10"  >
   </tr>
   <tr>
     <td> &nbsp; </td>
    </tr>
   <tr>
   <td>Interest Rate Php </td>
   <td> <input type = text name = "solve_interest" value = "<?php echo $display_results;?>" size="12" readonly >
   </tr>
   <tr>
     <td> &nbsp; </td>
    </tr>
   <td colspan = 3>
        <input type = "submit" name="compute" value = "Compute Interest" title="Click here to compute for interest rate.">
        <input type = "submit" name="clear" value = "Clear" title="Click here to clear text boxes.">
   </td>
   </tr>
   </table>
   </form>
     </body>
   </html>








Tuesday, February 17, 2015

Simple Interest Solver in PHP

In this article I will show you how to compute simple amount interest rate solver using PHP. This program is very useful if you want to learn how much the interest should be paid in a loan in a certain amount of time. The code is very short and very easy to understand I hope you will find my work useful.

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



Sample Output of Our Program

Program Listing

<html>
<title> Simple Interest Solver</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'];
$rate = $_POST['rate'];
$time    = $_POST['time'];

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


$Solve_Interest = ($amount2 * $rate2 * $time) / 100;
  
$Total_Amount = ($amount2 + $Solve_Interest);

if(isset($_POST['check'])) {

$title .= " ===== GENERATED RESULT ===== " ."<BR><BR>";
$title .= "The computed interest is Php ".number_format($Solve_Interest,2,'.','').".<br><br>"; 
$title .= "The Total Amount to be paid is Php ".number_format($Total_Amount,2,'.','')."."; 
    
       
}
if(isset($_POST['clear'])) {
  $amount = " ";
  $rate = " ";
  $time = " ";
  $title= " ";
   
}
?>
<body style='background-color:lightgreen'>
<div style='width:800px;margin:auto'>
  <br> <h1 align="center"> Simple Interest Solver</h2>
 <form action="" method="post"><div>
  <div class="row"><label> Enter Principal Amount : </label> <input type="text" name="amount" 
           value="<?php echo $amount; ?>" autofocus required size=10/><br> </div>
<div class="row"> <label> Enter Rate of Interest  : </label><input type="text" name="rate" 
           value="<?php echo $rate; ?>" required size=10/><br> </div>
<div class="row"> <label> Enter Period of Time    : </label> <input type="text" name="time" 
           value="<?php echo $time; ?>"  required size=10/> </div> </div>   
  <br>
   <input type="submit" name="check" value="Compute Interest" 
  title="Click here to compute the Interest Amount."/>
  <input type="submit" name="clear" value="Clear" 
  title="Click here to clear text box and values on the screen"/>
</form>

<br> <br>

<?php 
echo $title;
 ?>
  </body>
</html>