<?php
/**
 * Praktikum DBWT. Autoren:
 * Şafak, Hazinedar, 3108590
 * Robert, Joel, 3672729
 */
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($_POST['rechnen'] == 'Addieren') {

        $number1 = $_POST['number1'];
        $number2 = $_POST['number2'];
        $ergebnis = $number1 + $number2;

    } elseif ($_POST['rechnen'] == "Multiplizieren") {
        $number1 = $_POST['number1'];
        $number2 = $_POST['number2'];
        $ergebnis = $number1 * $number2;
    }
}
?>

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8"/>
    <title>Addform</title>
    <style>
        * {
            font-family: Arial, serif;
        }
        .rating {
            color: darkgray;
        }
    </style>
</head>
<body>
    <form action="m2_5c_addform.php" method="post">
    <label for="number1">Erste Zahl:</label>
    <input id="number1" type="text" name="number1"/>
    <label for="number2">Zweite Zahl:</label>
    <input id="number2" type="text" name="number2"/>

    <input type="Submit" name="rechnen" value="Addieren" />
        <input type="Submit" name="rechnen" value="Multiplizieren" />

    <?php
    if(!empty($ergebnis))
    {
        echo "<br><br>Ergebnis: ".$ergebnis;
    }
    ?>
</body>
</html>
