1. Contoh Aplikasi Perhitungan LUAS PERSEGI PANJANG.
Penggunaan =
Script masukkan.php = HALAMAN 1
<body>
<form action="luas.php" method="POST">
Masukkan Nilai Panjang = <br>
<input type="number" name="a" maxlength="3"> <br>
Masukkan Nilai Lebar = <br>
<input type="number" name="b" maxlength="3"> <br>
<input type="submit" name="submit" value="HITUNG">
</form>
</body>
Script luas.php = HALAMAN 2
<?php
$a = $_POST['a'];
$b = $_POST['b'];
echo "panjang =$a <br>";
echo "lebar =$b <br>";
$C=$a*$b;
echo "luas =$C <br>";
?>
</body>
Hasilnya =
Halaman 1
Halaman 2
2. Contoh Aplikasi Perhitungan NILAI
Penggunaan =
Script satu.php = HALAMAN 1
<HTML>
<HEAD> <Title> PROSENTASE NILAI </Title> </HEAD>
<BODY>
<div align="center"> <H1> FORM PENILAIAN MATA KULIAH </h1> </div>
<form action="dua.php" method=POST>
<table name="table1" border="1" align="center" width="80%">
<TR bgcolor="green" border="1">
<TD align="center"> MACAM NILAI </TD>
<TD align="center"> PROSENTASE </TD>
<TD align="center"> NILAI MAHASISWA </TD>
<TD align="center"> KETERANGAN </TD>
</TR>
<TR>
<TD align="center"> Nilai Tugas </TD>
<TD align="center"> 10 % </TD>
<TD> : <input type="number" max="2" name="number1" size="5"> </TD>
<TD> <pre> A >= : 80 SANGAT BAIK </pre></TD>
</TR>
<TR>
<TD align="center"> Nilai QUIZ </TD>
<TD align="center"> 10 % </TD>
<TD> : <input type="number" max="2" name="number2" size="5"> </TD>
<TD> <pre> B > : 70-79 BAIK </pre></TD>
</TR>
</TR>
<TD align="center"> Nilai UTS </TD>
<TD align="center"> 30 % </TD>
<TD> : <input type="number" max="2" name="number3" size="5"> </TD>
<TD> <pre> C > : 60-69 CUKUP </pre></TD>
</TR>
<TR>
<TD align="center"> Nilai UAS </td>
<TD align="center"> 30 % </TD>
<TD> : <input type="number" max="2" name="number4" size="5"> + </TD>
<TD> <pre> D > : 50-59 KURANG </pre></TD>
</TR>
<TR>
<TD align="center" bgcolor="purple"> TOTAL </TD>
<TD align="center" bgcolor="purple"> 80 % </TD>
<TD align="left"> : Prosentase Total ada dihalaman 2 </TD>
<TD> <pre> E =< : 49 MENGULANG </pre> </TD>
</TR>
<TR>
<TH colspan="2"> <input type="submit" name="submit" value="HITUNG"> </TH>
<TH colspan="2"> <input type="reset" name="reset" value="RESET"> </TH>
</TR>
</table>
</BODY>
</HTML>
Script dua.php = HALAMAN 2
<html>
<head> <TITLE> hasil </TITLE> </head>
<body>
<div align="center">
<h1> FORM PENILAIAN MATA KULIAH </h1>
<h1> HALAMAN 2 </h1>
</div>
<?php
$a = $_POST['number1'];
$b = $_POST['number2'];
$c = $_POST['number3'];
$d = $_POST['number4'];
$satu = $a*0.1;
$dua = $b*0.1;
$tiga = $c*0.3;
$empat = $d*0.3;
$lima = $satu + $dua + $tiga + $empat;
?>
<table name="table2" border="1" align="center" width="80%">
<TR>
<TD bgcolor="green" align="center"> MACAM NILAI </TD>
<TD bgcolor="Green" align="center"> PROSENTASE NILAI </TD>
<TD bgcolor="Green" align="center"> KETERANGAN GRADE </TD>
</TR>
<TR>
<TD align="center"> Nilai Tugas </TD>
<TD align="center"> <?php echo $satu; ?> </TD>
<TD rowspan="5" align="center">
<?php
if($lima <= 49)
{ echo "ANDA HARUS MENGULANG"; }
else if ($lima <= 59)
{ echo "NILAI ANDA KURANG"; }
else if ($lima <= 69)
{ echo "NILAI ANDA CUKUP"; }
else if ($lima <= 79)
{ echo "NILAI ANDA BAIK"; }
else
{ echo "NILAI ANDA SANGAT MEMUASKAN"; } ?> </TD>
</TR>
<TR>
<TD align="center"> Nilai QUIZ </TD>
<TD align="center"> <?php echo $dua; ?> </TD>
</TR>
<TR>
<TD align="center"> Nilai UTS </TD>
<TD align="center"> <?php echo $tiga; ?> </TD>
</TR>
<TR>
<TD align="center"> Nilai UAS </TD>
<TD align="center"> <?php echo $empat; ?> </TD>
</TR>
<TR>
<TD bgcolor="Purple" align="center"> TOTAL </TD>
<TD align="center" bgcolor="green"> <?php echo $lima; ?> </TD>
</TR>
<TR>
<TD colspan="3" align="center"> <a href="uul.php"> <input type="submit" name="submit2" value="KE HALAMAN 1"> </a> </TD>
</TR>
</table>
</body>
</html>
Hasilnya =
Halaman 1
Halaman 2
0 komentar:
Posting Komentar