Created
November 25, 2017 21:49
-
-
Save pawelwch/fc7153ded49b61031da992ef6fad7758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="pl"> | |
<head> | |
<meta charset="utf-8"> | |
<title> <?php echo"Odliczanie";?> </title> | |
</head> | |
<body> | |
<form action="http://localhost/youtube1/petlaphp.php" method="post"> | |
<p>Wypisz od 1 do: | |
<input type="text" name="countto" size="20"> | |
</p> | |
<p> | |
<input type="submit" name="submit" value="Wyślij"> | |
</p> | |
</form> | |
</body> | |
</html> | |
<!DOCTYPE html> | |
<html lang="pl"> | |
<head> | |
<meta charset="utf-8"> | |
<title> <?php echo "Wywoływanie liczb"; ?> </title> | |
</head> | |
<body> | |
<?php | |
$countTo = (int) $_REQUEST['countto']; | |
$startNum = 1; | |
while ($startNum <= $countto) | |
{ | |
if (( $startNum % 2) != 0 ) | |
{ | |
echo $startNum, ","; | |
} | |
elseif ($startNum >= 1000) | |
{ | |
break; | |
} | |
else | |
{ | |
$startNum++; | |
continue; | |
} | |
$startNum++; | |
} | |
echo "<br><br>"; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment