mathiaspl20

Untitled

Jun 7th, 2016
61
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.  
  10.     <form action="" method="Post">
  11. <p>n1:<br/>
  12.         <input type="text" name="n1" value="<?PHP if(!empty($_POST['n1']))echo $_POST['n1']?>"><br><br>
  13. <p>n2:<br/>
  14.         <input type="text" name="n2" value="<?PHP if(!empty($_POST['n2']))echo $_POST['n2']?>">
  15.         <br>
  16.        
  17. <button type="submit" name="group1" id="add" value="add">+</button>
  18. <button type="submit" name="group1" id="subtract" value="subtract">-</button>
  19. <button type="submit" name="group1" id="times" value="times">*</button>
  20. <p>
  21. <button type="submit" name="group1" id="divide" value="divide">/</button>
  22. <button type="submit" name="group1" id="force" value="force">^</button>
  23. <button type="submit" name="group1" id="sqrt" value="sqrt">²√</button>
  24. <!-- <button type="submit" name="group1" id="xrt" value="divide">/</button>
  25.  <button type="submit" name="group1" id="divide" value="divide">/</button> -->
  26.  
  27.     </form>
  28.  
  29.  
  30. <p>
  31. answer:
  32. <p>
  33. <h1>
  34. <?php
  35. /*
  36. if (!empty($_POST['n1'])){
  37. $n1 = $_POST['n1'];
  38. $n2 = $_POST['n2'];
  39. else if($_POST['group1'] == 'sqrt') {
  40. echo sqrt($n1);
  41. }
  42. else if(!empty($_POST['n1']) && !empty($_POST['n2'])){
  43.  
  44. $n1 = $_POST['n1'];
  45. $n2 = $_POST['n2'];
  46. if($_POST['group1'] == 'add') {
  47. echo $n1 + $n2;
  48. }
  49. else if($_POST['group1'] == 'subtract') {
  50. echo $n1 - $n2;
  51. }
  52. else if($_POST['group1'] == 'times') {
  53. echo $n1 * $n2;
  54. }
  55. else if($_POST['group1'] == 'divide') {
  56. echo $n1 / $n2;
  57. }
  58. else if($_POST['group1'] == 'force') {
  59. echo pow($n1 , $n2);
  60. }
  61. }
  62. }
  63. else{}
  64. */
  65. // if(!empty($_POST['n1']) && !empty($_POST['n2'])){
  66. switch($_POST["group1"]){
  67.     case "add":
  68.         echo ($n1 + $n2);
  69.         break;
  70.     case "subtract":
  71.         echo ($n1 - $n2);
  72.         break;
  73.     case "times":
  74.         echo ($n1 * $n2);
  75.         break;
  76.     case "divide":
  77.         echo ($n1 / $n2);
  78.         break;
  79.     case "force":
  80.         echo (pow($n1, $n2));
  81.         break;
  82.     case "sqrt":
  83.         echo (sqrt($n1));
  84.         break;
  85. //  case(){$n1 $n2}
  86. //  case(){$n1 $n2}
  87.    
  88. }
  89.  
  90. // else{}
  91. ?>
  92.  
  93. </h1>
  94. </form>
  95. </body>
  96. </html>
RAW Paste Data