CLICK HERE FOR BLOGGER TEMPLATES AND MYSPACE LAYOUTS »

Selasa, 24 Maret 2009

BUKU TAMU

BUKU TAMU

&lthtml&gt
&lthead&gt
&lttitle&gtHalaman Buku tamu&lt/title&gt
&lt/head&gt

&ltbody&gt
Buku tamu - &lta href="lihat.php"&gtlihat isi buku tamu&lt/a&gt&ltbr /&gt
&ltbr /&gt
&lthr&gt
Isilah buku tamu kami&ltbr /&gt
&ltbr /&gt
&ltbr /&gt
&ltform id="form1? name="form1? method="post" action="isi.php"&gt
nama
&ltinput type="text" name="nama" id="nama" /&gt
&ltbr /&gt
&ltbr /&gt
pesan
&lttextarea name="pesan" id="pesan" cols="45? rows="5?&gt&lt/textarea&gt
&ltbr /&gt
&ltbr /&gt
&lthr&gt
&ltinput type="submit" name="Submit" id="Submit" value="Submit" /&gt
&lt/form&gt
&lt/body&gt
&lt/html&gt



















ISI PHP





&lthtml&gt
&lthead&gt
&lttitle&gtInput Data dari Form ke MySQL&lt/title&gt
&lt/head&gt

&ltbody&gt
&lt?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);


?&gt
Buku tamu - &lta href=lihat.php&gtlihat isi buku tamu&lt/a&gt&ltbr /&gt
&lt/body&gt
&lt/html&gt













LIAT PHP

&lthtml&gt
&lthead&gt
&lttitle&gtDaftar Data yang ada di MySQL&lt/title&gt
&lt/head&gt

&ltbody bgcolor="#000000"&gt
&lta href=bukutamu.php&gtIsi Buku Tamu&lt/a&gt&ltbr /&gt
&ltfont color="#FFFFFF" size="3"&gtIsi buku tamu&ltbr /&gt
&ltbr /&gt
&lt?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))
{
?&gt
&ltstrong&gtNama&lt/strong&gt: &lt?php echo $row->nama;?&gt&ltbr /&gt
&ltstrong&gtPesan&lt/strong&gt: &lt?php echo $row->pesan;?&gt&ltbr /&gt
&ltbr /&gt
&lt?php } ?&gt
&ltmarquee&gt
---
&lt/marquee&gt
&lt/font&gt &ltfont color="#FFFFFF"&gt
&ltmarquee&gt
&lt/marquee&gt
&lt/font&gt
&ltmarquee&gt
&ltfont color="#FF0000" size="3"&gtAYO KAMU BISA BIKIN PROGRAM PAKE PHP
running text&lt/font&gt----
&lt/marquee&gt
&lt/body&gt
&lt/html&gt



0 comments: