This commit is contained in:
3p01
2025-10-30 08:39:07 +01:00
parent edc3abedfa
commit db1d8ff09f
4 changed files with 641 additions and 53 deletions

View File

@@ -18,30 +18,32 @@
</div>
<div class="box">
<form action="index.php" method="post">
<label for="a">Wprowadź liczbę A:</label><br>
<input type="number" name="a" id="a"><br>
<label for="b">Wprowadź liczbę B:</label><br>
<input type="number" name="b" id="b"><br><br>
<fieldset>
<label for="a">Wprowadź liczbę A:</label>
<input type="number" name="a" id="a">
<label for="b">Wprowadź liczbę B:</label>
<input type="number" name="b" id="b">
</fieldset>
<button type="submit">Wyślij</button>
</form>
</div>
<div class="box">
<?php
if (isset($_POST['a']) && isset($_POST['b'])) {
$a = (int)htmlspecialchars($_POST['a']);
$b = (int)htmlspecialchars($_POST['b']);
if ($a < $b) {
for ($i = $a; $i <= $b; $i++) {
echo "$i ";
}
}
if ($b < $a) {
for ($i = $b; $i <= $a; $i++) {
echo "$i ";
}
<?php
if (isset($_POST['a']) && isset($_POST['b'])) {
echo '<div class="box">';
$a = (int)htmlspecialchars($_POST['a']);
$b = (int)htmlspecialchars($_POST['b']);
if ($a < $b) {
for ($i = $a; $i <= $b; $i++) {
echo "$i ";
}
}
?>
</div>
if ($b < $a) {
for ($i = $b; $i <= $a; $i++) {
echo "$i ";
}
}
echo '</div>';
}
?>
</body>
</html>