<html>
<head>
<title>Halaman Buku tamu</title>
</head>
<Body bgcolor='aqua'>
<body>
<b>Buku Tamu -</b> <a href="lihat.php"><b>Lihat Isi Buku Tamu </b></a><br />
<br>
<hr>
<u><b>Isi Buku Tamuku Cuy</b></u><br>
<br>
<br>
<form id="form1? name="form1? method="post" action="isi.php">
<b>Nama</b>
<input type="text" name="nama" id="nama" />
<br>
<br>
<b>Pesan</b>
<textarea name="pesan" id="pesan" cols="45? rows="5?></textarea>
<br>
<br>
<hr>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>
</body>
</html>
Selasa, 03 Maret 2009
Membuat Buku Tamu dengan PHP & My SQL
Diposting oleh Wisnu Fort Harwanto di 22.47 0 komentar
Isi PHP
<html>
<head>
<title>Input Data dari Form ke MySQL</title>
</head>
<Body bgcolor='aqua'>
<body>
<?php
$nama = $_POST['nama'];
$pesan = $_POST['pesan'];
$conn = mysql_connect("localhost","root","");
if (!$conn) {
echo "Could not connect to db";
exit(1);
}
$db = mysql_select_db("latihan",$conn);
$sqlText = "insert into bukutamu(nama, pesan,tanggal)
values('$nama','$pesan',NOW(''))";
mysql_query($sqlText);
?>
<b>Buku Tamu -</b> <a href=lihat.php><b>Lihat Isi Buku Tamu</b></a><br />
</body>
</html>
Diposting oleh Wisnu Fort Harwanto di 22.39 0 komentar
Lihat PHP
<html>
<head>
<title>Daftar Data yang ada di MySQL</title>
</head>
<body bgcolor="Green">
<a href=bukutamu.php><b>Isi Buku Tamu</b></a><br />
<font color='orange' size="3">Isi buku tamu<br />
<br />
<?php
$conn = mysql_connect("localhost","root","");
if (!$conn) {
echo "Could not connect to db";
exit(1);
}
$db = mysql_select_db("latihan",$conn);
$sqlText = "select * from bukutamu";
$result = mysql_query($sqlText);
while($row=mysql_fetch_object($result))
{
?>
<strong>Nama</strong>: <?php echo $row->nama;?><br />
<strong>Pesan</strong>: <?php echo $row->pesan;?><br />
<br />
<?php } ?>
</font> <font color='red'>
<marquee>
</marquee>
</font>
<marquee>
---- <font color='white' size="4">TERIMA KASIH</font> ----
</marquee>
</body>
</html>
Diposting oleh Wisnu Fort Harwanto di 22.18 0 komentar