Advertisement
Hydrase

accept from user and sum

Jun 7th, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <html>
  2. <body bg bgcolor="aqua">
  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 />";
  9. echo "number 2 is ". $_GET['num2']. "<br/>";
  10. $sum = $_GET["num1"] + $_GET["num2"];
  11. echo "the sum of two numbers is". $sum;
  12.  
  13. exit();
  14. }
  15.  
  16. }
  17.  
  18. ?>
  19. <html>
  20. <body>
  21.  
  22. <form action = "<?php $_PHP_SELF ?>" method = "GET">
  23. enter first number : <input type = "text" name = "num1" /><br/>
  24. enter second number : <input type = "text" name = "num2" /><br/>
  25. <input type = "submit" name ="submit" value="submit"/>
  26. </form>
  27.  
  28. </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement