form input


<html>
<head>
<title>Form input pegawai</title>
</head>

<body>

<table border=”1″ width=”80%” height=”600″ align=”center” frame=”above”>”);
<tr>
<td height=”150″ border=”1″ width=”80%” colspan=”2″><img src=”hearder_2.jpg”  height=”150″ width=”1200″></td>
</tr>

<tr>

<td height=”1″ border=”1″ valign=”justify” bgcolor=”#6699CC”>
<table align=”left” border=”0″ valign=”top” bgcolor=”#6699CC” frame=”above”>
<tr>
<td border=”1″ width=”100″ height=”52″><a href=”daftar_peg.php”><img src=”button_1.png”  height=”50″ width=”100″></a></td>
<td border=”1″ width=”100″ height=”52″><img src=”button_input2.png”  height=”50″ width=”100″></td>
</tr>
</table>
</td>
</tr>

<tr>
<td border=”1″ height=”80%” width=”90%” align=”center” valign=”top”>
<br><br>
<h2 align=”center”> Form input pegawai</h2>
<form action=”form_input.php” method=”post”>
<table width=”49%” border=”0″ align=”center”>
<tr>
<td width=”21%” height=”58″ align=”left”>NIP pegawai</td>
<td width=”79%”><input name=”nip” size=”70″ maxlenght=”70″ type=”text”></td>
</tr>

<tr>
<td height=”58″ align=”left”>Nama pegawai</td>
<td><input name=”nama” size=”70″ maxlenght=”70″ type=”text”></td>
</tr>

<tr>
<td height=”58″ align=”left”>Jenis kelamin</td>
<td><input type=”checkbox” value=”pria” checked=”checked” name=”jen_kel”> &nbsp pria</td>
</tr>

<tr>
<td height=”58″ align=”left”>Tanggal lahir</td>
<td>
<?php
require_once “skrip_tanggal.php”;
pilihan_tanggal(10,02,1991);
?>
</td>
</tr>

<tr>
<td height=”58″ align=”left”>Departemen</td>
<td>
<?php
$username=”root”;
$pass=””;
$alamat=”localhost”;

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

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

$sql=”select *from depart”;
$hasil=mysql_query($sql,$koneksi);

print(“<select name=\”dep\”>”);
while($baris=mysql_fetch_row($hasil)){
$kode_dep=$baris[0];
$nama_dep=$baris[1];

print(“<option value=\”$kode_dep\”>$nama_dep</option>”);
}
print(“</select>”);
?>
</td>
</tr>
</table>
<center><input type=”submit” value=”simpan” name=”buttonsimpan”></center>
</form>

<?php
require_once “format_tanggal.php”;

if($_POST[“buttonsimpan”]==”simpan”){
$nip=$_POST[‘nip’];
$nama=$_POST[‘nama’];
$jen_kel=$_POST[‘jen_kel’];
$dep=$_POST[‘dep’];
$nama_tgl=$_POST[‘nama_tanggal’];
$nama_bln=$_POST[‘nama_bulan’];
$nama_thn=$_POST[‘nama_tahun’];

$tgl_lahir=tgl_ke_my($nama_tgl,$nama_bln,$nama_thn);

if($jen_kel==”pria”){
$pria=TRUE;
}
else $pria=FALSE;

require_once “koneksi_karyawan.php”;

$sql_input=”insert into karyawan values(‘$nip’,’$nama’,’$tgl_lahir’,’$pria’,’$dep’)”;
mysql_query($sql_input,$coba);
}
?>
</td>
</table>
<br>

</td>
</tr>
</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