mathiaspl20

php calc

Jun 2nd, 2016
34
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="de">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>dEn Cliqulatoz</title>
  6. <h1>THe KLaCULATIOR</h1>
  7. </head>
  8. <body bgcolor="#FF00FF" background="http://bestanimations.com/Animals/Birds/Parrots/animated-parrot-gif-2.gif">
  9. <form method="post" attribute="post" >
  10. <p>First Value:<br/>
  11. <input type="text" id="first" name="first"></p>
  12. <p>Second Value:<br/>
  13. <input type="text" id="second" name="second"></p>
  14.  
  15. <!--
  16. <input type="radio" name="group1" id="add" value="add" checked="true"><p>+</p><br/>
  17. <input type="radio" name="group1" id="subtract" value="subtract"><p>-</p><br/>
  18. <input type="radio" name="group1" id="times" value="times"><p>x</p><br/>
  19. <input type="radio" name="group1" id="divide" value="divide"><p>/</p><br/>
  20. <p></p>
  21. -->
  22.  
  23. <button type="submit" name="group1" id="add" value="add">+</button>
  24. <button type="submit" name="group1" id="subtract" value="subtract">-</button>
  25. <button type="submit" name="group1" id="times" value="times">*</button>
  26. <button type="submit" name="group1" id="divide" value="divide">/</button>
  27.  
  28. <p>
  29. answer
  30. <p>
  31.  
  32. <?php
  33. $first = $_POST['first'];
  34. $second = $_POST['second'];
  35. if($_POST['group1'] == 'add') {
  36. echo $first + $second;
  37. }
  38. else if($_POST['group1'] == 'subtract') {
  39. echo $first - $second;
  40. }
  41. else if($_POST['group1'] == 'times') {
  42. echo $first * $second;
  43. }
  44. else if($_POST['group1'] == 'divide') {
  45. echo $first / $second;
  46. }
  47. ?>
  48. </form>
  49. </body>
  50. </html>
RAW Paste Data