Minggu, 02 Maret 2014

Form Upah Karyawan

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 2</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 Sesuai Jam Kerja</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">Jam Kerja</td>
          <td>:</td>
          <td><input type="text" name="jam" id="textfield2" /></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'];
$jk=$_POST['jam'];

if($jk>40)
{
$gj1=40*7500;
$lembur=($jk-40)*5000;
$gaji2=$gj1+$lembur;
}
else
{
$gaji2=$jk*7500;
}
echo "Nama : ".$nm;
echo "<br>Jumlah Jam Kerja (1 Minggu) : ".$jk;
echo "<br>Gaji : ".$gaji2;
?>
</body>
</html>

Tidak ada komentar:

Posting Komentar