<!DOCTYPE html>
<html lang="de">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>Einsendeaufgabe 4</title>
        <?php
        require("berechnung.php");
        require("setopt.php");
        ?>
    </head>
    <body>
        <h1>Grundstückspreise</h1>
        <?php berechnung() ?>
        <fieldset>
        <form method="post">
            <p>
                <label for="breite">Breite:</label>
                <input type="text" name="breite" id="breite" placeholder="Breite?" required autofocus value="<?= htmlspecialchars($_POST['breite']) ?? '' ?>">
            </p>
            <p>
                <label for="zahl2">Länge:</label>
                <input type="text" name="laenge" id="laenge" placeholder="Länge?" required value="<?= htmlspecialchars($_POST['laenge']) ?? '' ?>">
            </p>
            <p>
                <label for="pqm">Preis pro m²:</label>
                <input type="text" name="pqm" id="pqm" placeholder="Preis / m²?" required value="<?= htmlspecialchars($_POST['pqm']) ?? '' ?>">
            </p>
            <p>
                <label for="provision">Provisionssatz:</label>
                <select name="provision" id="provision">
                    <?php setOption("0.03", "3");?>                     
                    <?php setOption("0.04", "4");?>                   
                    <?php setOption("0.05", "5");?>                   
                    <?php setOption("0.06", "6");?>                   
                    <?php setOption("0.07", "7");?>
                </select>
            </p>
            <p>
                <label for="mws">Mehrwertsteuer</label>
                <input type="checkbox" name="mws" id="mws" value="0.19" <?= ($_POST['mws'] ?? '') == '0.19' ? 'checked' : '' ?>>
            </p>
            </fieldset>
            <p>
                <input type="submit" value="Berechnen">
            </p>
        </form>
    </body>    
</html>