Gambar 1.0 Ketika Button Lihat Nilai Diclick Maka Akan Tampil Seperti Gambar 2.0 |
Gambar 2.0 Ketika Click Input Nilai Maka Akan Tampil Seperti Gambar 1.0 |
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Latihan 4</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/Untitled-1.jpg)">
<form action="logikaif.php" method="post">
<center><h1>Form Data Nilai Mahasiswa</center></h1>
<pre>
NIM : <input type="text" size=8 name=nim>
Nama : <input type="text" size=30 name=nama>
Mata Kuliah : <select name=matkul>
<option>--Pilih Mata Kuliah--</option>
<option value="Web Programming">Web Programming</option>
<option value="Visual Foxpro">Visual Foxpro</option>
<option value="Linux System Administrator">Linux System Administrator</option>
</select>
Nilai Absensi : <input type="text" size=5 name=absen>
Nilai Tugas : <input type="text" size=5 name=tugas>
Nilai UTS : <input type="text" size=5 name=uts>
Nilai UAS : <input type="text" size=5 name=uas>
<br><br>
<input type="submit" value="Lihat Nilai"><input type="reset" value=Batal>
</form>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama logikaif.php) :
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Latihan 4</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/Untitled-1.jpg)">
<?
$nim=$_POST['nim'];
$nama=$_POST['nama'];
$matkul=$_POST['matkul'];
$absen=$_POST['absen'];
$tugas=$_POST['tugas'];
$uts=$_POST['uts'];
$uas=$_POST['uas'];
$nilai=($absen*0.1)+($tugas*0.2)+($uts*0.3)+($uas*0.4);
if($nilai>80)
{$grade='A';}
else
if($nilai>68)
{$grade='B';}
else
if($nilai>54)
{$grade='C';}
else
if($nilai>30)
{$grade='D';}
else
{$grade='E';}
echo "<center><h1>Nilai Hasil Studi</h1></center>";
echo "<pre>";
echo "NIM : $nim<br>";
echo "Nama : $nama<br>";
echo "Mata Kuliah : $matkul<br>";
echo "Nilai Absensi : $absen<br>";
echo "Nilai Tugas : $tugas<br>";
echo "Nilai UTS : $uts<br>";
echo "Nilai UAS : $uas<br>";
echo "<hr align=left width=30%>";
echo "Grade : $grade<br>";
?>
<h3><a href="latihan4.html">Input Nilai</a></h3>
</body>
</html>
0 komentar:
Posting Komentar