Facebook
From Blush Parrot, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 103
  1. <html>
  2. <head>
  3. <title>Zadanko2</title>
  4. </head>
  5.  
  6. <body>
  7. <h2>Zadank2</hr> <br>
  8.         <form action="index2.php" method="post">
  9.         <input type="number" name="zad_liczba1" placeholder="Podaj liczbe"><br>
  10.         <input type="number" name="zad_liczba2" placeholder="Podaj liczbe"><br>
  11.         <input type="submit" value="wyslij"
  12.         </form>
  13.        
  14.         <?php
  15.         if(isset($_POST["zad2_liczba"]) && isset($_POST["zad2_liczba2"])){
  16.                 $liczba1 = $_POST["zad2_liczba1"];
  17.                 $liczba2 = $_POST["zad2_liczba2"];
  18.        
  19.         if((!empty($liczba1) && !empty($liczba2)) || ($liczba1 == 0 ||$liczba2 == 0)){
  20.                 $a = 0;
  21.                 $b = 0;
  22.        
  23.         if($liczba1 > $liczba2){
  24.                 $a = $liczba2;
  25.                 $b = $liczba1;
  26.         }
  27.         else {
  28.                 $a = $liczba1;
  29.                 $b = $liczba2;
  30.         }
  31.         echo"<br>";
  32.        
  33.         for($i=$a; $i<=$b; $i++){
  34.                 echo $i."\n";
  35.         }
  36.         else {
  37.                 echo "Nie wpisano liczby";
  38.                         }
  39.                 }
  40.         }
  41.         ?>
  42.         </body>
  43. </html>