<html>
<head><title>Pertemuan mix php</title></head>
<body>
<form method="post" action="hal2.php">
Nilai Tugas:
<input type="text" name="tugas"/>
<br/><br/>
Nilai Quis:
<input type="text" name="quis"/>
<br/><br/>
Nilai Absen:
<input type="text" name="absen"/>
<br/><br/>
Nilai UTS:
<input type="text" name="uts"/>
<br/><br/>
Nilai UAS:
<input type="text" name="uas"/>
<br/><br/>
<br/><br/>
<input type="submit" name="proses" value="proses"/>
</form>
</body>
</html>
script utk menampilakan hasil dai inputan simpan dengan nama file hal2.php
<html>
<head>
<title>Hasil</title>
</head>
<body>
<?php
$tugas=$_POST["tugas"];
$quis=$_POST["quis"];
$absen=$_POST["absen"];
$uts=$_POST["uts"];
$uas=$_POST["uas"];
?>
<?php
$total=(($tugas*10/100)+($quis*10/100)+($absen*20/100)+($uts*25/100)+($uas*35/100));
echo" Nilai Tugas=".$tugas;
echo"<br>";
echo" Nilai Quis=".$quis;
echo"<br>";
echo" Nilai Absen=".$absen;
echo"<br>";
echo" Nilai UTS=".$uts;
echo"<br>";
echo" Nilai UAS=".$uas;
echo"<br>";
echo" Nilai Akhir=".$total;
echo"<br>";
if($total>=80)
echo"Nilai A";
else if($total>=70)
echo"Nilai B";
else if($total>=60)
echo"Nilai C";
else
echo"Nilai D";
?>
</body>
</html>
utk menjalankannya cukup buka file hal1 dan inputkan seperti tampilan gbr berikut"
tampilan hasil setelah di klik button proses
Tidak ada komentar:
Posting Komentar