Advertisement
Hydrase

calculator (php)

Jun 7th, 2025
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <?php
  5. if(isset( $_GET["num1"])||isset( $_GET["num2"]))
  6. {
  7. if( $_GET["num1"] || $_GET["num2"] ) {
  8. echo "number 1 is ". $_GET['num1']. "<br /><br />";
  9. echo "number 2 is ". $_GET['num2']. "<br/>";
  10. $sum = $_GET["num1"] + $_GET["num2"];
  11. $pro = $_GET["num1"] * $_GET["num2"];
  12. $diff = $_GET["num1"] - $_GET["num2"];
  13. echo "the sum of two numbers is". $sum."<br/><br/>";
  14. echo "the prod of two numbers is". $pro."<br/><br/>";
  15. echo "the diff of two numbers is". $diff;
  16.  
  17. exit();
  18. }
  19.  
  20. }
  21.  
  22. ?>
  23. <html>
  24. <body>
  25.  
  26. <form action = "<?php $_PHP_SELF ?>" method = "GET">
  27. enter first number : <input type = "text" name = "num1" /><br/><br/>
  28. enter second number : <input type = "text" name = "num2" /><br/>
  29. <input type = "submit" name ="submit" value ="click me"/>
  30. </form>
  31.  
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement