Membuat Buku Tamu
- ..
<head>
<title>Buku Tamu HTML</title>
</head>
<body>
<form action="tamu.php" method="post">
<p align="center"><h3>Guest Book</h3></p>
<table>
<td>Nama :</td>
<td><input type="text" size="11" name="nama" /><td>
<title>Buku Tamu HTML</title>
</head>
<body>
<form action="tamu.php" method="post">
<p align="center"><h3>Guest Book</h3></p>
<table>
<td>Nama :</td>
<td><input type="text" size="11" name="nama" /><td>
<tr><td>E-Mail :</td>
<td><input type="text" size="11" name="email" /><td></tr>
<tr><td>URL :</td>
<td> <input type="text" size="11" name="url" /></td></tr>
<tr><td>Pesan :</td>
<td><textarea cols="11" rows="6" name="pesan"></textarea></td></tr>
<tr><td><input type="submit" value="SEND" name="Send" /></td>
<td><input type="reset" value="BATAL" name="reset" /></td></tr>
</table>
</form>
</body>
</html>
simpan dengan nama inputtamu.html di folder htdocs xampp
untuk output nya ketikan kode berikut :
<html>
<head>
<title>TAMU</title>
</head>
<body>
<?php
mysql_connect("localhost","root","password");
mysql_select_db("guestbook");
$nama=$_POST['nama'];
$email=$_POST['email'];
$url=$_POST['url'];
$pesan=$_POST['pesan'];
$simpan="insert into tamu values ('$nama','$email','$url','$pesan')";
mysql_query("$simpan");
echo"<h3>GUEST BOOK</h3>";
echo"<pre>";
echo"Nama : $nama<br>";
echo"E-mail : $email<br>";
echo"URL : $url<br>";
echo"Pesan : $pesan<br>";
?>
</body>
</html>