Gambar 1.0 Ketika Button Proses Diclick Maka Akan Tampil Seperti Gambar 2.0 |
Gambar 2.0 Ketika Click Home Maka Akan Tampil Seperti Gambar 1.0 |
Coding/Listing Gambar 1.0 (Simpan Dengan Nama latihan5.html) :
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Latihan 5</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/Abstract%20Blue%20backgrounds%2012.jpg)">
<form action="output.php" method="post">
<center><h1>PT XXX</center></h1>
<center><h2>Daftar Gaji Karyawan</center></h2>
<hr />
<pre>
NIP : <input type="text" size=10 name=nip>
Nama : <input type="text" size=35 name=nama>
Golongan : <select name=gol>
<option>--Pilih Golongan--</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
</select>
Status Perkawinan : <input type="radio" name=sk value="Nikah">Nikah
<input type="radio" name=sk value="Belum Nikah">Belum Nikah
Jumlah Anak : <input type="text" size=3 name=ja>
<br>
<input type="submit" value=Proses><input type="reset" value=Batal>
</form>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama output.php) :
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Latihan 5</title>
</head>
<body style="background-image:url(http://localhost/Adam/Background%20Blogger/Abstract%20Blue%20backgrounds%2012.jpg)">
<?
$nip=$HTTP_POST_VARS['nip'];
$nama=$HTTP_POST_VARS['nama'];
$gol=$HTTP_POST_VARS['gol'];
$sk=$HTTP_POST_VARS['sk'];
$ja=$HTTP_POST_VARS['ja'];
if($gol=='A')
{
$gapok=1500000;
$tunj=500000;
}
else
if($gol=='B')
{
$gapok=2000000;
$tunj=700000;
}
else
if($gol=='C')
{
$gapok=2500000;
$tunj=900000;
}
else
if($gol=='D')
{
$gapok=3000000;
$tunj=1100000;
}
else
{
$gapok=0;
$tunj=0;
}
if($sk=='Nikah')
{
$tunji=0.1*$gapok;
}
else
{
$tunji=0;
}
if($ja<=3)
{
$tunja=2/100*$ja*$gapok;
}
else
{
$tunja=0;
}
$totgaj=$gapok+$tunj+$tunji+$tunja;
echo "<center><h1>PT XXX</h1></center>";
echo "<center><h2>Daftar Gaji Karyawan</h2></center>";
echo "<hr />";
echo "<pre>";
echo "NIP : $nip<br>";
echo "Nama : $nama<br>";
echo "Golongan : $gol<br>";
echo "Status Perkawinan : $sk<br>";
echo "Gaji Pokok : $gapok<br>";
echo "Tunjangan Jabatan : $tunj<br>";
echo "Tunjangan Istri : $tunji<br>";
echo "Tunjangan Anak : $tunja<br>";
echo "Total Gaji : $totgaj<br>";
?>
<center><h3><a href="latihan5.html">Home</center></h3></a>
</body>
</html>
0 komentar:
Posting Komentar