Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- $wahl = "";
- if ($_POST) {
- if (isset($_POST['zahl1']) && isset($_POST['zahl2']) && isset($_POST['zahl3']) && isset($_POST['tf3'])) {
- $zahl1 = $_POST['zahl1'];
- $zahl2 = $_POST['zahl2'];
- $zahl3 = $_POST['zahl3'];
- $wahl=$_POST['tf3'];
- echo $zahl1. ', '. $zahl2. ', '. $zahl3. '<br>';
- if (($wahl=="R") || ($wahl=="r"))
- echo 'Die Fläche des Kreisrings ist: ',anuri_flaeche_kring($zahl1, $zahl2, $zahl3), '<br>';
- if (($wahl=="S") || ($wahl=="s"))
- echo 'Die Fläche des Kreissektors ist: ',anuri_flaeche_ksektor($zahl1, $zahl2, $zahl3), '<br>';
- } else {
- echo 'Setz eine Zahl in jedes Feld ein <br>';
- }
- }
- function anuri_flaeche_kring($zahl1, $zahl2, $zahl3) {
- $pi=3.14;
- $R=$zahl1**2*$pi-$zahl2**2*$pi;
- return $R;
- }
- function anuri_flaeche_ksektor($zahl1, $zahl2, $zahl3) {
- $pi=3.14;
- $S=$zahl1**2*$pi*$zahl3/360;
- return $S;
- }
- ?>
- <body>
- <h2>Kreisring und Kreissektor:</h2>
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
- radius (aussen):
- <input type="text" name="zahl1">
- radius (innen):
- <input type="text" name="zahl2">
- Winkel (alpha):
- <input type="text" name="zahl3">
- Kreissektor (S) /Kreisring (R) <input type="text" name="tf3" size="10" maxlength="" value="<?=$wahl?>" >
- <input type="submit">
- </form>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement