Podaj Liczbę:
Otwórz w trybie kompatybilności.

Kod

<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <style>
        .form{
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100px;
        }
        #gora{
            background-color: #1af;
            padding: 10px;
        }
        #gora{
            background-color: lightblue;
            padding: 10px;
        }
    </style>
</head>
<body>
    <div id="gora" class="form">
        <form action="formularz.php" method="post">
            Podaj Liczbę:
            <input type="text" name="x" maxlength=5><br>
            <input type="submit" value="Wyślij">
            <input type="reset" value="Czyść">
        </form>
    </div>
    <div id="dol" class="form">
        <?php
            // var_dump($_POST);
            if (isset($_POST['x'])) {
                if (empty($_POST['x'])) {
                    echo "nie podano liczby";
                    exit();
                }
                else {
                    echo "<script> document.forms[0].x.value=".$_POST['x']."</script>";
                    $a=$_POST['x'];
                    echo "Podano liczbę: $a";
                    // header("Location: formularz.php");  //-przekierowanie na inny adres
                }
            }
        ?>
    </div>
</body>
</html>