<!DOCTYPE html>
<html>
    <head>
        <title>Konversi Nilai Angka</title>
    </head>
    <body>
        <h3>Form Konversi Nilai</h3>
        <form action="KonversiNilaiAngka.php" method="POST">
            Nilai : <input type="text" name="nilai" /><br/>
            <input type="submit" name="ok" value="OK"/>
</form>
        <?php
        if (isset($_POST["ok"])){
            $nilai = $_POST["nilai"];

            if ($nilai >= 85 && $nilai <= 100) {
                $huruf = "A";
            } else if ($nilai >= 70 && $nilai <= 84) {
                $huruf = "B";
            } else if ($nilai >= 60 && $nilai <= 70) {
                $huruf = "C";
            } else if ($nilai >= 50 && $nilai <= 60) {
                $huruf = "D";
            } else if ($nilai < 50) {
                $huruf = "E";
            } else {
                $huruf = "FIELD";
            }

            echo "<h4>Hasil Konversi</h4>";
            echo "Nilai : " . $nilai . "<br/>";
            echo "Huruf : " . $huruf . "<br/>";
        }
        ?>
    </body>
</html>