<html>
<head>
    <title>Latihan Konversi Nilai</title>
</head>
<body>

<form action="" 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";
    } elseif ($nilai >= 70 && $nilai <= 84) {
        $huruf = "B";
    } elseif ($nilai >= 60 && $nilai < 70) {
        $huruf = "C";
    } elseif ($nilai >= 50 && $nilai < 60) {
        $huruf = "D";
    } else {
        $huruf = "E";
    }

    echo "Nilai " . $nilai . " dikonversi menjadi huruf : <b>" . $huruf . "</b>";
}
?>

</body>
</html>