bahasa program php

Membuat input data KTP

Membuat pengimputan data kartu tanda penduduk (ktp)
Simpan dengan nama file dataktp.php

<html>
<head><title>Membuat profile</title></head>
<body>
<form method="POST"action="dataktp2.php">
<table width="490px"cellpadding="4px"border="1px"><tr><td width="160px">1.usernama</td><td width="6px">:</td><td width="324px"><input type="text"name="usernama"></td></tr>
<tr><td width="160px">2.NIK</td><td width="6px">:</td><td width="324px"><input type="text"name="nik"></td></tr>
<tr><td width="160px">3.nama</td><td width="6px">:</td><td width="324px"><input type="text"name="nama"></td></tr>
<tr><td width="160px">4.tempat tgl.lahir</td><td width="6px">:</td><td width="324px"><input type="text"name="lahir"></td></tr>
<tr><td width="160px">5.Jenis kelamin</td><td width="6px">:</td><td width="324px"><input type="radio"name="kelamin"value="laki-laki">Laki-laki<input type="radio"name="kelamin"value="perempuan">perempuan</td></tr>
<tr><td width="160px">6.alamat tinggal</td><td width="6px">:</td><td width="324px"><input type="text"name="alamat"></td></tr>
<tr><td width="160px">7.Agama</td><td width="6px">:</td><td width="324px"><input type="text"name="agama"></td></tr>
<tr><td width="160px">8.status</td><td width="6px">:</td><td width="324px"><input type="radio"name="status"value="belum kawin">belum kawin<input type="radio"name="status"value="kawin">kawin<input type="radio"name="status"value="janda/duda">janda/duda</td></tr>
<tr><td width="160px">9.pekerjaan</td><td width="6px">:</td><td width="324px"><input type="text"name="kerja"></td></tr>
<tr><td width="160px">10.berlaku sampai</td><td width="6px">:</td><td width="324px"><input type="text"name="berlaku"></td></tr></table><table width="490px"bgcolor="#DFEBF8"cellpadding="2px"border="1px"align="center"><tr><td><input type="submit"value="kirimkan"></td></tr></table>
</form>
</body>
</html>

image

Berikut hasil dari pengimputan data KTP
Simpan dengan nama dataktp2.php
<html>
<head><title>Membuat profile
</title></head>
<body>
<?php
$usernama=$_POST["usernama"];
$nik=$_POST["nik"];
$nama=$_POST["nama"];
$lahir=$_POST["lahir"];
$kelamin=$_POST["kelamin"];
$alamat=$_POST["alamat"];
$agama=$_POST["agama"];
$status=$_POST["status"];
$kerja=$_POST["kerja"];
$berlaku=$_POST["berlaku"];
if($usernama==false || $nik==false || $nama==false || $lahir==false || $kelamin==false || $alamat==false || $agama==false || $status==false || $kerja==false || $berlaku==false){
echo "<font style='color:red;'>profila tidak lengkap</font><br/>";
}else{
$baris=array("$usernama","$nik","$nama","$lahir","$kelamin","$alamat","$agama","$status","$kerja","$berlaku");
$usernama=$baris[0]; $nik=$baris[1]; $nama=$baris[2]; $lahir=$baris[3]; $kelamin=$baris[4]; $alamat=$baris[5]; $agama=$baris[6]; $status=$baris[7]; $kerja=$baris[8]; $berlaku=$baris[9];
echo "<font style='color:green;'>menyimpan profila</font>";

echo '<table width="900px"bgcolor="#DFEBF8"cellpadding="4px"align="left">';echo '<tr>';echo '<th width="100px">nik</th>';echo '<th width="100px">nama</th>';echo '<th width="100px">lahir</th>';echo '<th style="width:100px;">kelamin</th>';echo '<th width="100px">alamat</th>';echo '<th width="100px">agama</th>';echo '<th width="100px">status</th>';echo '<th width="100px">kerja</th>';echo '<th width="100px">berlaku</th>';echo '<th width="100px">usernama</th>';echo '</tr>';echo '</table>';
echo '<table width="900px"bgcolor="white"cellpadding="2px"border="1px"bordercolor="#DFEBF8"align="left;">';echo '<tr>';echo '<form method="GET"action="dataktp2.php">';echo '<td width="100px">'.$nik.'</td>';echo '<td width="100px">'.$nama.'</td>';echo '<td width="100px">'.$lahir.'</td>';echo '<td width="100px">'.$kelamin.'</td>';echo '<td width="100px">'.$alamat.'</td>';echo '<td width="100px">'.$agama.'</td>';echo '<td width="100px">'.$status.'</td>';echo '<td width="100px">'.$kerja.'</td>';echo '<td width="100px">'.$berlaku.'</td>';echo '<td width="100px"><input type="hidden"name="usernama"value="'.$usernama.'"><input type="submit"value="edit"></td>';echo '</form>';echo '</tr>';echo '</table>';
}?>
</body>
</html>

image

Demikianlah pembuatan data input ktp telah selesai kita buat, semoga dapat dipahami dan bermanfaat.

Advertisements
Standard

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