CONTOH form pendaftaran pakai PHP
CONTOH form pendaftaran pakai PHP
Kodenya bisa di coba :
<!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 wahyu</title>
</head>
<body>
<form action="tampil.php" method="post" enctype="multipart/form-data"
name="form1" id="form1">
<table align="center">
<tr>
<td colspan="3"><h1>Daftar KTP</h1><h3>Silahkan Isi :</h3></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td><input type="text" placeholder="Nama Lengkap" name="name"></td>
</tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td>
<select name="tgl">
<?php
for ($i=1;$i<=31;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
<select name="bln">
<?php
$bulan=array("Bulan","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
for ($i=1;$i<=12;$i++)
{
echo "<option value=".$i.">".$bulan[$i]."</option>";
}
?>
</select>
<select name="thn">
<?php
for ($i=1985;$i<=2014;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td>
<input type="radio" name="JK" value="Laki-Laki" />Laki-Laki
<input type="radio" name="JK" value="Perempuan" />Perempuan
</td>
<tr>
<td>Gol Darah</td>
<td> :</td>
<td>
<select name="darah">
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="O">O</option>
</select>
</td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><textarea name="alamat" placeholder="Alamat Anda"></textarea></td>
</tr>
<tr>
<td>Agama</td>
<td>:</td>
<td><select name="agama">
<option value="islam">Islam</option>
<option value="Kristen">Kristen</option>
<option value="Hindu">Hindu</option>
<option value="Buddha">Buddha</option>
</select>
</td>
</tr>
<tr>
<td>Status Perkawinan</td>
<td>:</td>
<td>
<input type="radio" value="Menikah" name="SP"/>Menikah
<input type="radio" value="Belum Menikah" name="SP" />Belum Menikah
</td>
</tr>
<tr>
<td>Pekerjaan</td>
<td>:</td>
<td>
<input type="text" name="pekerjaan" placeholder="Pekerjaan">
</td>
</tr>
<tr>
<td>Kewarnegaraan</td>
<td>:</td>
<td><select name="negara">
<option value="Indonesia">Indonesia</option>
<option value="Malaysia">Malaysia</option>
<option value="Brunei">Brunei</option>
<option value="Timor Leste">Timor Leste</option>
</select>
</td>
<tr>
<td>Masa Berlaku</td>
<td>:</td>
<td>
<select name="tgl1">
<?php
for ($i=1;$i<=31;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
<select name="bln1">
<?php
$bulan=array("Bulan","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
for ($i=1;$i<=12;$i++)
{
echo "<option value=".$i.">".$bulan[$i]."</option>";
}
?>
</select>
<select name="thn1">
<?php
for ($i=1985;$i<=2020;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
</td>
</tr>
</tr>
<tr>
<td>Photo</td>
<td>:</td>
<td><input type="file" name="fupload" /></td>
</tr>
<tr>
<td><input type="submit" value="Mendaftar" />
<input type="reset" value="Cancel" /></td>
<td></td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
Untuk tampilannya :
<!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>Untitled Document</title>
</head>
<body>
<?php
ERROR_REPORTING(0);
$JK=$_POST['JK'];
$name=$_POST['name'];
$alamat=$_POST['alamat'];
$agama=$_POST['agama'];
$tgl=$_POST['tgl'];
$bln=$_POST['bln'];
$thn=$_POST['thn'];
$tgl1=$_POST['tgl1'];
$bln1=$_POST['bln1'];
$thn1=$_POST['thn1'];
$SP=$_POST['SP'];
$darah=$_POST['darah'];
$negara=$_POST['negara'];
$pekerjaan=$_POST['pekerjaan'];
//Membaca nama file
$file_name = $_FILES['fupload']['name'];
//Membaca ukuran file
$size = $_FILES['fupload']['size'];
//Membaca jenis file
$file_type = $_FILES['fupload']['type'];
//Source tempat fupload file sementara
$source = $_FILES['fupload']['tmp_name'];
//Tempat fupload file disimpan
$direktori = "files/$file_name";
//Memindahkan fupload file dari direktori sementara ke tempat permanen
move_uploaded_file($source,$direktori);
//Menampilkan keterangan file
echo "<table align='center' Bgcolor='lightblue'>
<tr>
<td colspan=5 align=center><h3>Kartu Tanda Penduduk $negara</h3></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td colspan=2>$name</td>
<td rowspan=4>
<img src=$direktori height=100 width=90>
</td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td colspan=2>$tgl-$bln-$thn</td>
<td></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td colspan=2>$JK Gol Darah: $darah</td>
<td></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td colspan=2>$alamat</td>
<td></td>
</tr>
<tr>
<td>Agama</td>
<td>:</td>
<td colspan=2>$agama</td>
<td></td>
</tr>
<tr>
<td>Status Perkawinan</td>
<td>:</td>
<td colspan=2>$SP</td>
<td></td>
</tr>
<tr>
<td>Pekerjaan</td>
<td>:</td>
<td colspan=2>$pekerjaan</td>
<td></td>
</tr>
<tr>
<td>Kewarnegaraan</td>
<td>:</td>
<td colspan=2>$negara</td>
<td></td>
</tr>
<tr>
<td>Masa Berlaku</td>
<td>:</td>
<td colspan=2>$tgl1/$bln1/$thn1</td>
<td></td>
</tr>
<tr>
<td><A HREF='javascript:window.print()'>Print</A></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>";
?>
</body>
</html>
Kodenya bisa di coba :
<!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 wahyu</title>
</head>
<body>
<form action="tampil.php" method="post" enctype="multipart/form-data"
name="form1" id="form1">
<table align="center">
<tr>
<td colspan="3"><h1>Daftar KTP</h1><h3>Silahkan Isi :</h3></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td><input type="text" placeholder="Nama Lengkap" name="name"></td>
</tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td>
<select name="tgl">
<?php
for ($i=1;$i<=31;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
<select name="bln">
<?php
$bulan=array("Bulan","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
for ($i=1;$i<=12;$i++)
{
echo "<option value=".$i.">".$bulan[$i]."</option>";
}
?>
</select>
<select name="thn">
<?php
for ($i=1985;$i<=2014;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td>
<input type="radio" name="JK" value="Laki-Laki" />Laki-Laki
<input type="radio" name="JK" value="Perempuan" />Perempuan
</td>
<tr>
<td>Gol Darah</td>
<td> :</td>
<td>
<select name="darah">
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="O">O</option>
</select>
</td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td><textarea name="alamat" placeholder="Alamat Anda"></textarea></td>
</tr>
<tr>
<td>Agama</td>
<td>:</td>
<td><select name="agama">
<option value="islam">Islam</option>
<option value="Kristen">Kristen</option>
<option value="Hindu">Hindu</option>
<option value="Buddha">Buddha</option>
</select>
</td>
</tr>
<tr>
<td>Status Perkawinan</td>
<td>:</td>
<td>
<input type="radio" value="Menikah" name="SP"/>Menikah
<input type="radio" value="Belum Menikah" name="SP" />Belum Menikah
</td>
</tr>
<tr>
<td>Pekerjaan</td>
<td>:</td>
<td>
<input type="text" name="pekerjaan" placeholder="Pekerjaan">
</td>
</tr>
<tr>
<td>Kewarnegaraan</td>
<td>:</td>
<td><select name="negara">
<option value="Indonesia">Indonesia</option>
<option value="Malaysia">Malaysia</option>
<option value="Brunei">Brunei</option>
<option value="Timor Leste">Timor Leste</option>
</select>
</td>
<tr>
<td>Masa Berlaku</td>
<td>:</td>
<td>
<select name="tgl1">
<?php
for ($i=1;$i<=31;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
<select name="bln1">
<?php
$bulan=array("Bulan","Januari","Pebruari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember");
for ($i=1;$i<=12;$i++)
{
echo "<option value=".$i.">".$bulan[$i]."</option>";
}
?>
</select>
<select name="thn1">
<?php
for ($i=1985;$i<=2020;$i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
</td>
</tr>
</tr>
<tr>
<td>Photo</td>
<td>:</td>
<td><input type="file" name="fupload" /></td>
</tr>
<tr>
<td><input type="submit" value="Mendaftar" />
<input type="reset" value="Cancel" /></td>
<td></td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
Untuk tampilannya :
<!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>Untitled Document</title>
</head>
<body>
<?php
ERROR_REPORTING(0);
$JK=$_POST['JK'];
$name=$_POST['name'];
$alamat=$_POST['alamat'];
$agama=$_POST['agama'];
$tgl=$_POST['tgl'];
$bln=$_POST['bln'];
$thn=$_POST['thn'];
$tgl1=$_POST['tgl1'];
$bln1=$_POST['bln1'];
$thn1=$_POST['thn1'];
$SP=$_POST['SP'];
$darah=$_POST['darah'];
$negara=$_POST['negara'];
$pekerjaan=$_POST['pekerjaan'];
//Membaca nama file
$file_name = $_FILES['fupload']['name'];
//Membaca ukuran file
$size = $_FILES['fupload']['size'];
//Membaca jenis file
$file_type = $_FILES['fupload']['type'];
//Source tempat fupload file sementara
$source = $_FILES['fupload']['tmp_name'];
//Tempat fupload file disimpan
$direktori = "files/$file_name";
//Memindahkan fupload file dari direktori sementara ke tempat permanen
move_uploaded_file($source,$direktori);
//Menampilkan keterangan file
echo "<table align='center' Bgcolor='lightblue'>
<tr>
<td colspan=5 align=center><h3>Kartu Tanda Penduduk $negara</h3></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td colspan=2>$name</td>
<td rowspan=4>
<img src=$direktori height=100 width=90>
</td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td colspan=2>$tgl-$bln-$thn</td>
<td></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td colspan=2>$JK Gol Darah: $darah</td>
<td></td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td colspan=2>$alamat</td>
<td></td>
</tr>
<tr>
<td>Agama</td>
<td>:</td>
<td colspan=2>$agama</td>
<td></td>
</tr>
<tr>
<td>Status Perkawinan</td>
<td>:</td>
<td colspan=2>$SP</td>
<td></td>
</tr>
<tr>
<td>Pekerjaan</td>
<td>:</td>
<td colspan=2>$pekerjaan</td>
<td></td>
</tr>
<tr>
<td>Kewarnegaraan</td>
<td>:</td>
<td colspan=2>$negara</td>
<td></td>
</tr>
<tr>
<td>Masa Berlaku</td>
<td>:</td>
<td colspan=2>$tgl1/$bln1/$thn1</td>
<td></td>
</tr>
<tr>
<td><A HREF='javascript:window.print()'>Print</A></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>";
?>
</body>
</html>
No comments: