ini comtoh membuat form
<html>
<head>
<title>Tugas Web2 modul 4</title>
</head>
<body background="urang.jpg">
<h3>My Profile</a></h3>
<form action="MyProfile.php" method="post">
<table width="370">
<tr>
<td width="56" valign="top"><font size="2"><strong>Nim</strong></font></td>
<td width="4" valign="top">:</td>
<td width="272"><input type="text" name="nim" size="50" maxlength="25"></td>
</tr>
<tr>
<td valign="top"><font size="2"><strong>Nama</strong></font></td>
<td valign="top">:</td>
<td><input type="text" name="nama" size="50" maxlength="40"></td>
</tr>
<tr>
<td valign="top"><font size="2"><strong>Kelas</strong></font></td>
<td valign="top">:</td>
<td><input type="text" name="kelas" size="50" maxlength="40"></td>
</tr>
<tr>
<td valign="top"><font size="2"><strong>Prodi</strong></font></td>
<td valign="top">:</td>
<td><input type="text" name="prodi" size="50" maxlength="40"></td>
</tr>
<tr>
<td valign="top"><font size="2"><strong>Alamat</strong></font></td>
<td valign="top">:</td>
<td><textarea name="alamat" cols="44" rows="5"></textarea></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="submit" name="btnSubmit" value="Submit"></td>
</tr>
</table></form>
</div>
<div class="col_l">
</div>
<div style="clear: both"><img src="images/spaser.gif" alt="" width="1" height="1" /></div>
<div style="clear: both"><img src="images/spaser.gif" alt="" width="1" height="1" /></div>
</div>
<div id="footer">
</div>
</div>
<?php
$nim = $_POST["nim"];
$nama = $_POST["nama"];
$kelas = $_POST["kelas"];
$prodi = $_POST["prodi"];
$alamat = $_POST["alamat"];
if (isset ($_POST["btnSubmit"])) {
echo "<h3>Data yang dimasukan:</h3>";
echo "<strong>Nim :</strong> $nim<br />";
echo "<strong>Nama :</strong> $nama<br>";
echo "<strong>Kelas :</strong> $kelas<br>";
echo "<strong>Prodi :</strong> $prodi<br>";
echo "<strong>Alamat :</strong> $alamat<br>";
}
?>
<br>
</body>
</html>
Tidak ada komentar:
Posting Komentar