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>

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>

Pembuatan Form PMB

Tampilan dari Form PMB :
Jika user sudah menginput data, akan keluar hasilnya :
Berikut Coding PHP dan HTML nya
<!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>Form</title>
<style type="text/css">
<!--
body {
background-image: url(bahan/1920x1080.jpg);
}
.style1 {color: #CCCCCC}
.style2 {font-size: 18px}
.style3 {
color: #FFFFFF;
font-size: 24px;
}
.style4 {color: #FF0000}
-->
</style></head>

<body>
<form id="form1" name="form1" method="post" action="forms2.php">
  <p>
  
  <table width="804" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="181" rowspan="2"><span class="style2"><img src="bahan/itech.png" alt="" width="164" height="130" /></span></td>
      <td width="623"><img src="bahan/form.png" width="200" height="50" /></td>
    </tr>
    <tr>
      <td><img src="bahan/silahkan2.png" width="454" height="18" /></td>
    </tr>
  </table>
  <p>
  
  <table width="586" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="2"><p align="center" class="style3">Form Pendaftaran Mahasiswa I-Tech</p>
          <p>&nbsp;</p></td>
    </tr>
    <tr>
      <td width="299" height="26"><span class="style1">Nama<span class="style4">*</span></span></td>
      <td width="287"><label>
        <input type="text" name="nama" id="nama" />
      </label></td>
    </tr>
    <tr>
      <td height="57"><span class="style1">Tempat, Tanggal Lahir</span></td>
      <td><label></label>
        <label>
<input type="text" name="tempat" id="tempat" />
<select name="tanggal" size="1" id="tanggal">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="11">11</option>
  <option value="12">12</option>
  <option value="13">13</option>
  <option value="14">14</option>
  <option value="15">15</option>
  <option value="16">16</option>
  <option value="17">17</option>
  <option value="18">18</option>
  <option value="19">19</option>
  <option value="20">20</option>
  <option value="21">21</option>
  <option value="22">22</option>
  <option value="23">23</option>
  <option value="24">24</option>
  <option value="25">25</option>
  <option value="26">26</option>
  <option value="27">27</option>
  <option value="28">28</option>
  <option value="29">29</option>
  <option value="30">30</option>
  <option value="31">31</option>
</select>
<select name="bulan" size="1" id="bulan">
  <option value="Januari">Januari</option>
  <option value="Februari">Februari</option>
  <option value="Maret">Maret</option>
  <option value="April">April</option>
  <option value="Mei">Mei</option>
  <option value="Juni">Juni</option>
  <option value="Juli">Juli</option>
  <option value="Agustus">Agustus</option>
  <option value="November">November</option>
  <option value="Oktober">Oktober</option>
  <option value="November">November</option>
  <option value="Desember">Desember</option>
</select>
<select name="tahun" size="1" id="tahun">
  <option value="1990">1990</option>
  <option value="1991">1991</option>
  <option value="1992">1992</option>
  <option value="1994">1993</option>
  <option value="1995">1995</option>
  <option value="1996">1996</option>
  <option value="1997">1997</option>
  <option value="1998">1998</option>
  <option value="1999">1999</option>
  <option value="2000">2000</option>
</select>
<br />
      </label></td>
    </tr>
    <tr>
      <td><span class="style1">Alamat</span></td>
      <td><label>
        <textarea name="alamat" id="alamat" cols="45" rows="5"></textarea>
      </label></td>
    </tr>
    <tr>
      <td height="28"><span class="style1">Jenis Kelamin</span></td>
      <td><label>
      <input type="radio" name="sex" id="radio" value="Laki-laki" />
      <span class="style1">Laki-laki</span>
      <input type="radio" name="sex" id="radio2" value="Perempuan" />
      <span class="style1">Perempuan</span></label></td>
    </tr>
    <tr>
      <td height="27"><span class="style1">Asal Sekolah</span></td>
      <td><label>
        <input type="text" name="sekolah" id="sekolah" />
      </label></td>
    </tr>
    <tr>
      <td height="22"><span class="style1"> Nilai Uan</span></td>
      <td><p><input type="text" name="uan" id="uan" />
      </p>      </td>
    </tr>
    <tr>
      <td height="48">&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Kirim" />
      <input type="reset" name="button2" id="button2" value="Hapus" /></td>
    </tr>
  </table>
  <label></label>
  <p>&nbsp;  </p>
</form>
<p>&nbsp;</p>
</body>
</html>
Script PHP nya :
<?php
session_start();
$_SESSION['nama'] = $_POST['nama'];
//$_SESSION['email'] = $_POST['email'];
if (empty($_SESSION['nama'])){
echo "<h1>Forbidden</h1>";
exit;
}
?>
<!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>Pengecekan Data Diri</title>
<style type="text/css">
<!--
body {
background-image: url(bahan/1920x1080.jpg);
background-repeat: no-repeat;
}
body,td,th {
color: #FFFFFF;
font-size: 18px;
}
.style2 {font-size: 18px}
-->
</style></head>

<body>
<table width="765" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="163" rowspan="2"><span class="style2"><img src="bahan/itech.png" alt="" width="164" height="130" /></span></td>
    <td width="602"><img src="bahan/form.png" alt="" width="200" height="50" /></td>
  </tr>
  <tr>
    <td><img src="bahan/pengecekan2 copy.png" alt="" width="602" height="23" /></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>
<?php 
//else {


$nm=$_POST["nama"];
$tpt=$_POST["tempat"];
$tgl=$_POST["tanggal"];
$bln=$_POST["bulan"];
$thn=$_POST["tahun"];
$almt=$_POST["alamat"];
$jk=$_POST["sex"];
$as=$_POST["sekolah"];
$un=$_POST["uan"];


echo "Nama : " .$_SESSION['nama']. "<br>";
echo "Tempat, Tanggal Lahir : $tpt, $tgl $bln $thn <br>";
echo "Alamat : $almt <br>";
echo "Jenis Kelamin : $jk <br>";
echo "Asal Sekolah : $as <br>";
echo "Nilai UAN : $un <br>";


echo'<script>alert("Terima kasih telah mengisi form, silahkan cek kembali data diri anda!!")</script>';
//}
?>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="1330" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1089" rowspan="2">&nbsp;</td>
    <td width="140" height="85">&nbsp;</td>
    <td width="101">&nbsp;</td>
  </tr>
  <tr>
    <td height="43">&nbsp;</td>
    <td><a href="form5.html"><img src="bahan/Kembali.png" width="120" height="39" border="0" /></a></td>
  </tr>
</table>
</body>
</html>