Google Ads

Simple Calculator v3 PHP Script


Simple Calculator v3 PHP Script

This is a simple Calculator that you can use in your project or systems. Just download the source code and follow the instructions below.

DIRECTIONS

Code:
 
  1. <form>
  2. <table style="border:2px solid #000;">
  3. <tr>
  4. <td style="background-color:lightblue; color:#000; font-family:'Times New Roman'">Enter First Number</td>
  5. <td colspan="1">
  6. <input name="fvalue" type="number" style="color:blue"/></td>
  7. <tr>
  8. <td style="color:#000; font-family:'Times New Roman'">Select Operator</td>
  9. <td>
  10. <select name="operator" style="width: 63px">
  11. <option>+</option>
  12. <option>-</option>
  13. <option>*</option>
  14. <option>/</option>
  15. </select></td>
  16. </tr>
  17. <tr>
  18. <td style="background-color:lightblue; color:#000; font-family:'Times New Roman'">Enter First Number</td>
  19. <td class="auto-style5">
  20. <input name="lvalue" type="number" style="color:blue;"/></td>
  21. </tr>
  22. <tr>
  23. <td></td>
  24. <td><input type="submit" name="calculate" value="Calculate" style="color:wheat;background-color:red;" /></td>
  25. </tr>
  26. <tr>
  27. <td style="background-color:lightblue;color:#000;">Output = </td>
  28. <td style="color:darkblue"><?php echo $res;?></td>
  29. </tr>
  30. </table>
  31. </form>

 

PHP CODE

Code:
 
  1. <?php
  2. ini_set('display_errors',0);
  3. if( isset( $_REQUEST['calculate'] ))
  4. {
  5. $operator=$_REQUEST['operator'];
  6. if($operator=="+")
  7. {
  8. $add1 = $_REQUEST['fvalue'];
  9. $add2 = $_REQUEST['lvalue'];
  10. $res= $add1+$add2;
  11. }
  12. if($operator=="-")
  13. {
  14. $add1 = $_REQUEST['fvalue'];
  15. $add2 = $_REQUEST['lvalue'];
  16. $res= $add1-$add2;
  17. }
  18. if($operator=="*")
  19. {
  20. $add1 = $_REQUEST['fvalue'];
  21. $add2 = $_REQUEST['lvalue'];
  22. $res =$add1*$add2;
  23. }
  24. if($operator=="/")
  25. {
  26. $add1 = $_REQUEST['fvalue'];
  27. $add2 = $_REQUEST['lvalue'];
  28. $res= $add1/$add2;
  29. }
  30. if($_REQUEST['fvalue']==NULL && $_REQUEST['lvalue']==NULL)
  31. {
  32. echo "<script language=javascript> alert(\"Please Enter values.\");</script>";
  33. }
  34. else if($_REQUEST['fvalue']==NULL)
  35. {
  36. echo "<script language=javascript> alert(\"Please Enter First value.\");</script>";
  37. }
  38. else if($_REQUEST['lvalue']==NULL)
  39. {
  40. echo "<script language=javascript> alert(\"Please Enter second value.\");</script>";
  41. }
  42. }
  43. ?>

 

For more information and inquiries, feel free to comment below or email me at [email protected] May this simple calculator may help you in your projects or systems.

 

 


Related Post

Bulk Whatsapp Sender PHP Script Bulk Whatsapp Sender PHP Script A windows application developed using Visual Studio.Net 2015 and based on Whatsapp Web, it allows sending bulk What...
Ecommerce Multi-Vendor Website Builder – The... Ecommerce Multi-Vendor Website Builder - The Complete Multi-vendor CMSEcommerce Multi-Vendor Website Builder - The Complete Multi-vendor CMSOur multiv...
ImgHosting v1.2 – Image Storage System ImgHosting v1.2 - Image Storage System ImgHosting – Image Storage System quick and easy image hosting without registration. Service is ideal for fast...
4shared PHP Script Free Download 4shared PHP Script Free Download You can create mobile beautiful File Download site using this php script. You can download from here.   ...
INSTALIKE: Instagram like responsive photo gallery... INSTALIKE: Instagram like responsive photo gallery PHP Script Introducing INSTALIKE! What is Instalike? Instalike is a responsive instagram like ...

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

"