Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <html>
  2. <?php
  3. $wahl = "";
  4. if ($_POST) {
  5. if (isset($_POST['zahl1']) && isset($_POST['zahl2']) && isset($_POST['zahl3']) && isset($_POST['tf3'])) {
  6. $zahl1 = $_POST['zahl1'];
  7. $zahl2 = $_POST['zahl2'];
  8. $zahl3 = $_POST['zahl3'];
  9. $wahl=$_POST['tf3'];
  10. echo $zahl1. ', '. $zahl2. ', '. $zahl3. '<br>';
  11. if (($wahl=="R") || ($wahl=="r"))
  12. echo 'Die Fläche des Kreisrings ist: ',anuri_flaeche_kring($zahl1, $zahl2, $zahl3), '<br>';
  13. if (($wahl=="S") || ($wahl=="s"))
  14. echo 'Die Fläche des Kreissektors ist: ',anuri_flaeche_ksektor($zahl1, $zahl2, $zahl3), '<br>';
  15. } else {
  16. echo 'Setz eine Zahl in jedes Feld ein <br>';
  17. }
  18. }
  19.  
  20. function anuri_flaeche_kring($zahl1, $zahl2, $zahl3) {
  21. $pi=3.14;
  22. $R=$zahl1**2*$pi-$zahl2**2*$pi;
  23. return $R;
  24.  
  25. }
  26. function anuri_flaeche_ksektor($zahl1, $zahl2, $zahl3) {
  27. $pi=3.14;
  28. $S=$zahl1**2*$pi*$zahl3/360;
  29. return $S;
  30. }
  31. ?>
  32. <body>
  33. <h2>Kreisring und Kreissektor:</h2>
  34. <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
  35. radius (aussen):
  36. <input type="text" name="zahl1">
  37. radius (innen):
  38. <input type="text" name="zahl2">
  39. Winkel (alpha):
  40. <input type="text" name="zahl3">
  41. Kreissektor (S) /Kreisring (R) <input type="text" name="tf3" size="10" maxlength="" value="<?=$wahl?>" >
  42. <input type="submit">
  43. </form>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement