How to Create SIP Calculator in PHP – Web Application: SIP Calculator in PHP with source code, demo, and also how you can execute full program easily. To complete the program you need to follow those steps given bellow
Live Demo
Also Helpful –
PHP Age Calculator with Source Code
SIP Calculator in PHP with Source Code
To calculate SIP (Systematic Investment Plan) the main thing is the formula. The returns on SIP are calculated as per the amount of compound interest. You need to input the amount, return percentage, and select how many years you want to invest SIP Calculator automatically calculates the amount.
The formula of Calculate SIP-
monthly rate = return percentage/12/100;
future value =investment amount * (pow(1 + monthly rate, months) – 1) / monthly rate;
Back to coding, To complete this program with debugging free code you have to create only one file (index.php) because we use the bootstrap framework to style our CSS. And we also post data on the same page using the PHP function “isset($_POST[‘submit’]))”
that only shows data ones it’s submitted.
index.php
Create a PHP file named ‘index.php‘ and put those codes given below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
<!-- Coding Debugging (https://codingdebugging.com) --> <!DOCTYPE html> <html lang="en"> <head> <title>SIP Calculator - Coding Debugging</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> <!-- Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> <!-- Font Awesome --> <script src="https://kit.fontawesome.com/996973c893.js" crossorigin="anonymous"></script> <!-- Google Fonts --> <link href="https://fonts.googleapis.com/css2?family=Baloo+Thambi+2:wght@400;500;600;700;800&display=swap" rel="stylesheet"> <!-- My Stylesheet --> <style type="text/css"> body { font-family: "Baloo Thambi 2", cursive; } </style> </head> <body> <div class="container-fluid bg-light p-5 text-center my-3"> <h2 class="">SIP Calculator</h1> <h5 class="text-muted">Systematic Investment Plan Calculator</h5> </div> <div class="container bg-light p-3 my-5"> <div class="card-body"> <form action="index.php" method="post" class="form-group"> <div class="row mb-3"> <div class="col-md-4"> <button class="btn btn-dark">Monthly Investment Amount (Rs.)</button><br> <input type="number" class="form-control" name="amount" id="amount" value="1000" placeholder="Enter Amonut" required=""> </div> <div class="col-md-4"> <button class="btn btn-dark">Investment Period (Years)</button><br> <input type="number" class="form-control" name="period" id="period" value="10" placeholder="Enter Investment Period" required=""> </div> <div class="col-md-4"> <button class="btn btn-dark">Expected Annual Returns (%)</button><br> <input type="number" class="form-control" name="return" id="return" value="15" placeholder="Enter Expected Annual Returns (%)" required=""> </div> </div> <div class="row" align="right"> <div class="col-md-12"> <input type="submit" name="submit" class="btn btn-primary " value="Calculate"> </div> </div> </form> </div> <div class="card-footer"> <?php if(isset($_POST['submit'])) { ?> <div class="row"> <div class="col-md-12"> <button class="btn btn-dark">Result</button> </div> </div> <br> <?php $amount=$_POST['amount']; $period=$_POST['period']; $return=$_POST['return']; $monthlyRate = $return/12/100; $months = $period * 12; $futureValue = $amount * (pow(1 + $monthlyRate, $months) - 1) / $monthlyRate; $invested=$months * $amount; $wealth_gain=$futureValue - $invested; echo $a = "<b>Expected Amount</b> = " . round($futureValue,2) . " <br/>"; echo $b = "<b>Amount Invested</b> = " . round($invested,2) . " <br/>"; echo $b = "<b>Profit Amount</b> = " . round($wealth_gain,2) . " <br/>"; } ?> </div> </div> <hr> <footer class="footer mt-auto py-3 bg-light"> <div class="container text-center"> <span class="text-muted">Copyright ©2020 | SIP Calculator | <a href="https://codingdebugging.com/" target="_blank">CodingDebugging.Com</a></span> </div> </footer> </body> </html> |
Thank you for visiting!
We appreciate you for your precious time. I hope you are learn something from here! If you have any queries about this coding comment down below we will reply ASAP.
Keep coding, Keep debugging!