Facebook
From sraka, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 166
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Cwiczenie</title>
  6. </head>
  7. <body>
  8.    <h1>Funkcja</h1>
  9.    
  10.    <form action="funkcja_03_1.php" method="post">
  11.      <h2>Dane</h2>
  12.      
  13.      <input type="text" name="input1" value="3.14159"> : Liczba<br>
  14.  
  15.      <input type="submit" value="Wyślij">
  16.      
  17.       <hr><br>
  18.    </form>
  19.    
  20.    
  21.     <?php
  22.    
  23.     function radianyNaStopnie($radiany)
  24.     {
  25.         return ($radiany * 180 / M_PI);
  26.     }
  27.    
  28.     if($_SERVER['REQUEST_METHOD']=="POST")
  29.     {
  30.        
  31.         $x = $_REQUEST["input1"];
  32.         $y = radianyNaStopnie($x);
  33.        
  34.         echo $x." radianów to ".$y." stopni";
  35.     }
  36.    
  37.    
  38.     ?>
  39. </body>
  40. </html>