50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
?>
|
|
<!doctype html>
|
|
<html lang="pl">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Z38 - Wieksze lub równe</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Zadanie Z38</h1>
|
|
<h2>Autor: Jakub Grzegorczyk</h2>
|
|
</header>
|
|
<div class="box">
|
|
<p>Napisz program, który: dla liczby całkowitych (program sprawdza, czy podane liczny są całkowite) A i B wyświetla, która z nich jest większa lub czy są równe.</p>
|
|
</div>
|
|
<div class="box">
|
|
<form action="index.php" method="post">
|
|
<fieldset>
|
|
<label for="a">Podaj A:</label>
|
|
<input type="number" name="a" id="a" required>
|
|
<label for="b">Podaj B:</label>
|
|
<input type="number" name="b" id="b" required>
|
|
</fieldset>
|
|
<button type="submit">Wyślij</button>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|
$a = (int)$_POST['a'];
|
|
$b = (int)$_POST['b'];
|
|
echo "<div class='box'>";
|
|
echo "A: $a<br>B: $b<br>";
|
|
if ($a > $b) {
|
|
echo "Liczba {$a} jest wieksza od {$b}";
|
|
} elseif ($a == $b) {
|
|
echo "Liczby są równe";
|
|
} else {
|
|
echo "Liczba {$b} jest wieksza od {$a}";
|
|
}
|
|
echo "</div>";
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|