Gambar 1.0 Ketika Button Simpan Diclick Maka Akan Tampil Seperti Gambar 2.0 |
Gambar 2.0 Ketika Click Back Maka Akan Tampil Seperti Gambar 1.0 |
Coding/Listing Gambar 1.0 (Simpan Dengan Nama latihan2.html) :
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Database TXT</title>
</head>
<body bgcolor="Gray">
<form action="simpan.php" method="post">
<h1 align="center">..:: Daftar Gaji Pegawai::..</h1>
<div align="center">
<table boder="3">
<tr>
<td width="92">Nama Pegawai</td>
<td width="3">:</td>
<td width="271"><input type="text" name="nama"</td>
</tr>
<tr>
<td>Nip Pegawai</td>
<td> </td>
<td><label>
<input type="text" name="nip">
</label></td>
</tr>
<tr>
<td>Kode Jabatan</td>
<td>:</td>
<td><input type="radio" name="kode" value="Staff">Staff
<input type="radio" name="kode" value="Manager">Manager
<input type="radio" name="kode" value="Direktur">Direktur
</td>
</tr>
<tr>
<td colspan="3"><input type="submit" value="Simpan">
<input type="reset" value="Hapus"></td>
</tr>
</table>
</form>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama simpan.php) :
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Database TXT</title>
</head>
<body bgcolor="gray">
<?
$nama=$HTTP_POST_VARS['nama'];
$nip=$HTTP_POST_VARS['nip'];
if($kode=="Staff"){
$gaji=1200000;
}elseif($kode=="Manager"){
$gaji=2000000;
}else{
$gaji=5000000;}
echo "<h1>Data Karyawan</h1>";
echo "<pre>";
echo "<strong>";
echo "<font size=3>";
echo "Nama Saya : $nama<br>";
echo "Nip Saya : $nip<br>";
echo "Jabatan : $kode<br>";
echo "Gaji : $gaji<br></strong></font>";
?>
<br>
<center>
<h3><a href="latihan2.html">Back</a></h3>
</center>
</body>
</html>
0 komentar:
Posting Komentar