Jika user sudah menginput data, akan keluar hasilnya :
Berikut Coding PHP dan HTML nya
Script PHP 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> </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"> </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> </p></form><p> </p></body></html>
<?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> </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> </p>
<p> </p>
<p> </p>
<p> </p>
<table width="1330" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1089" rowspan="2"> </td>
<td width="140" height="85"> </td>
<td width="101"> </td>
</tr>
<tr>
<td height="43"> </td>
<td><a href="form5.html"><img src="bahan/Kembali.png" width="120" height="39" border="0" /></a></td>
</tr>
</table>
</body>
</html>
Tidak ada komentar:
Posting Komentar