Minggu, 02 Maret 2014

Form Perhitungan Gaji

Berikut Tampilannya :

Berikut Kodingnya :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tugas 2 No 1</title>
<style type="text/css">
<!--
.style1 {font-size: 24px}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <table width="391" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="500"><table width="391" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="3"><div align="center" class="style1">Perhitungan gaji dengan pajak 15%</div></td>
          </tr>
        <tr>
          <td width="166" height="29">Nama</td>
          <td width="10">:</td>
          <td width="324"><label>
            <input type="text" name="nama" id="textfield" />
          </label></td>
        </tr>
        <tr>
          <td height="31">Gaji Pokok</td>
          <td>:</td>
          <td><input type="text" name="gaji" id="textfield2" /></td>
        </tr>
        <tr>
          <td height="28">Tunjangan</td>
          <td>:</td>
          <td><input type="text" name="tunjangan" id="textfield3" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><label>
            <input type="submit" name="button" id="button" value="Hitung" />
            <input type="reset" name="button2" id="button2" value="Hapus" />
          </label></td>
        </tr>
      </table></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<?php
$nm=$_POST['nama'];
$gj=$_POST['gaji'];
$tj=$_POST['tunjangan'];
$gk = $gj + $tj;
$pajak = 0.15 * $gk;
$gb = $gj + $tj - $pajak;

echo "Nama : ".$nm;
echo "<br>Gaji Pokok : ".$gj;
echo "<br>Tunjangan : ".$tj;
echo "<br>Pajak : ".$pajak;
echo "<br>Gaji Bersih : ".$gb
?>


</body>
</html>

Tidak ada komentar:

Posting Komentar