Advertisement
muhidins

Branching

Nov 18th, 2021
990
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.31 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <title>Tugas Branching | Tampilkan Huruf sesuai jumlah looping</title>
  9.     <link rel="shortcut icon" href="../html/images/0.png" type="image/x-icon">
  10.     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
  11. </head>
  12.  
  13. <body>
  14.     <div class="container">
  15.         <h1>Aturan Nilai RGI 2021</h1>
  16.         <form action="" method="post">
  17.             <div>
  18.                 <input type="text" name="nama" class="form-control" placeholder="Nama Lengkap" required autofocus>
  19.             </div>
  20.             <div class="form-input">
  21.                 <input type="number" name="nilai" class="form-control" placeholder="Nilai" required>
  22.             </div>
  23.             <input type="submit" name="proses" value="Proses">
  24.         </form>
  25.         <?php
  26.         if(isset($_POST['proses'])) {
  27.             $nama = $_POST['nama'];
  28.             $nilai = $_POST['nilai'];
  29.            
  30.             if($nilai>=85 AND $nilai<=100) {
  31.                 $ip=4; $huruf="A";
  32.             } else if($nilai>=80 AND $nilai<85) {
  33.                 $ip=3.7; $huruf="A-";
  34.             } else if($nilai>=75 AND $nilai<80) {
  35.                 $ip=3.3; $huruf="B+";
  36.             } else if($nilai>=70 AND $nilai<75) {
  37.                 $ip=3; $huruf="B";
  38.             } else if($nilai>=65 AND $nilai<70) {
  39.                 $ip=2.7; $huruf="B-";
  40.             } else if($nilai>=60 AND $nilai<65) {
  41.                 $ip=2.3; $huruf="C+";
  42.             } else if($nilai>=55 AND $nilai<60) {
  43.                 $ip=2; $huruf="C";
  44.             } else if($nilai>=50 AND $nilai<55) {
  45.                 $ip=1.7; $huruf="C-";
  46.             } else if($nilai>=40 AND $nilai<50) {
  47.                 $ip=1; $huruf="D";
  48.             } else if($nilai>=0 AND $nilai<40) {
  49.                 $ip=0; $huruf="E";
  50.             } else {
  51.                 $ip=""; $huruf="Salah input nilai";
  52.             }
  53.             echo "$nama, Nilai Anda $nilai, masuk dalam kategori $huruf dengan Indeks Prestasi $ip";
  54.         }
  55.         ?>
  56.     </div>
  57. </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement