form tampil

<html>
<head>
<title>Daftar karyawan</title>
<link rel=”stylesheet” type=”text/css” href=”css_ku.css”>
</head>

<body>

<?php
require_once “kelas_halaman.php”;
include “format_tanggal.php”;

$username=”root”;
$pass=””;
$alamat=”localhost”;

$coba=mysql_connect($alamat,$username,$pass);
if(!$coba) die(“koneksi gagal”);

$select=mysql_select_db(“departemen”,$coba);
if(!$select) die(“database tidak bisa dipilih”);

$hap=$_GET[‘hapus’];
$kon=$_GET[‘kode’];

if($hap==1){
$sql_hapus=”delete from karyawan where nip=’$kon'”;
mysql_query($sql_hapus,$coba);
}

$jumlah=20;
$test=new halaman($jumlah);
$query=mysql_query(“select *from karyawan order by nama”,$coba);
$account=mysql_num_rows($query);
$test->berapa_halaman($account);

$awal=$test->awal_data();

//bagian hearder
print(“<table border=\”1\” width=\”80%\” height=\”900\” align=\”center\” frame=\”above\”>”);
print(“<tr>”);
print(“<td height=\”150\” border=\”1\” width=\”80%\” colspan=\”2\”><img src=\”hearder_2.jpg\”  height=\”150\” width=\”1200\”></td>”);
print(“</tr>”);

//bagian menu
print(“<tr>”);
print(“<td height=\”10\” border=\”1\” bgcolor=\”#6699CC\”>.</td>”);
print(“<td height=\”10\” border=\”1\” valign=\”justify\” bgcolor=\”#6699CC\”>”);
print(“<table align=\”left\” border=\”0\” valign=\”top\” bgcolor=\”#6699CC\” frame=\”above\”>”);
print(“<tr>”);
print(“<td border=\”1\” width=\”100\” height=\”50\”><img src=\”button_1.png\”  height=\”50\” width=\”100\”></td>”);
print(“<td border=\”1\” width=\”100\” height=\”50\”><a href=\”form_input.php\”><img src=\”button_input.png\”  height=\”50\” width=\”100\”></a></td>”);
print(“</tr>”);
print(“</table>”);
print(“</td>”);
print(“</tr>”);

//table dalam kiri
print(“<tr>”);
print(“<td width=\”20%\”>”);
print(“.”);

//table dalam kanan
print(“</td>”);
print(“<td border=\”1\” height=\”80%\” width=\”90%\” align=\”right\” valign=\”top\”>”);
print(“<h2 align=\”center\”>Daftar Pegawai</center></h2>”);

$sql=”select *from karyawan order by nama LIMIT $awal, $jumlah”;
$hasil=mysql_query($sql,$coba);
if(!hasil) die(“sql gagal”);

$nomor=$awal;

print(“<table align=\”center\” width=\”80%\” border=\”1\” frame=\”above\”>”);
print(“<tr bgcolor=\”#0066CC\”>”);
print(“<td width=\”8%\”><font color=\”#FFFFFF\”><center>No</center></font></td>”);
print(“<td width=\”10%\”><font color=\”#FFFFFF\”><center>NIP</center></font></td>”);
print(“<td width=\”23%\”><font color=\”#FFFFFF\”><center>Nama</center></font></td>”);
print(“<td width=\”14%\”><font color=\”#FFFFFF\”><center>Tanggal lahir</center></font></td>”);
print(“<td width=\”12%\”><font color=\”#FFFFFF\”><center>ket edit</center></font></td>”);
print(“<td width=\”12%\”><font color=\”#FFFFFF\”><center>ket hapus</center></font></td>”);
print(“</tr>”);

while($baris=mysql_fetch_row($hasil)){
$NIP=$baris[0];
$nama=$baris[1];
$tgl_lhr=$baris[2];
$nomor++;

$transform=my_ke_tgl2($tgl_lhr);

if($nomor%2==0){
$warna=”#FFCC99″;
}
else $warna=”#99CCCC”;

print(“<tr bgcolor=\”$warna\”>”);
print(“<td width=\”5%\”><font color=\”#CC0033\”><center>$nomor</center></font></td>”);
print(“<td width=\”8%\”><center>$NIP</center></td>”);
print(“<td width=\”21%\”>$nama</td>”);
print(“<td width=\”10%\”>$transform</td>”);
$skrip=$_SERVER[‘PHP_SELF’];
print(“<td width=\”8%\”><a href=\”edit_karyawan.php?kode=$NIP\”><center>edit</center></a></td>”);
print(“<td width=\”8%\”><a href=\”$skrip?kode=$NIP&hapus=1\” ”
.”onclick=\”return confirm(‘Data $nama dihapus?’)\”><center>hapus</center></a></td>”);

print(“</tr>”);

}

print(“<tr>”);
print(“<td width=\”200\” colspan=\”3\”>”);
$test->tampilkan_halaman();
print(“</td>”);
print(“<td width=\”200\”>”);
print(“</td>”);
print(“</td>”);
print(“<td width=\”200\”>”);
print(“</td>”);

print(“</tr>”);
print(“</table>”);
print(“<br>”);

print(“</td>”);
print(“</tr>”);
print(“</table>”);
?>
</body>
</html>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s