Vous êtes sur la page 1sur 5

TAMBAH

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or


g/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>Untitled Document</title>
<style type="text/css">
body,td,th {
font-family: "Comic Sans MS", cursive;
color: #900;
}
body {
background-image: url(../Toko_kue/Persib.jpg);
}
#form1 div h2 tt {
color: #FF0;
}
#form1 div h1 tt strong {
color: #FF0;
}
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div align="center">
<h1><tt><strong>SILAKAN ISI TERLEBIH DAHULU !!!
</strong></tt></h1>
</div>
</form>
<table width = " 53%" border ="1" align = "center">
<tr>
<td colspan ="3" align = "center" bgcolor="#0066CC"><h2 style ="font:Tahoma,
Geneva,sans-serif; color;#30f;">BUKU TAMU </h2></td>
</tr>
<tr>
<td width ="16%" bgcolor="#FFFF99">Nama </td>
<td width ="6%" bgcolor="#FFFF99"><div align="center">: </div></td>
<td width ="78%" bgcolor="#FFFF99"><input type ="text" name ="nama" id ="nam
a"/></td>
</tr>
<tr>
<td bgcolor="#FFFF99" >Email </td>
<td bgcolor="#FFFF99" ><div align="center">: </div></td>
<td bgcolor="#FFFF99" ><input type ="text" name ="email" id ="email"/></td>
</tr>
<tr>
<td bgcolor="#FFFF99" >Pesan </td>
<td bgcolor="#FFFF99" ><div align="center">: </div></td>
<td bgcolor="#FFFF99" ><textarea name ="pesan" id = "pesan" cols ="45" rows
= "5"></textarea></td>
</tr>
<tr>
<td bgcolor="#FFFF99">&nbsp;</td>
<td bgcolor="#FFFF99">&nbsp;</td>
<td bgcolor="#FFFF99"><form id="form2" name="form2" method="post" action="si
mpanbukutamu.php">
<input type="submit" name="button" id="button" value="KIRIM" />
<input type="reset" name="button2" id="button2" value="BATAL" />
</form>
<a href="tampilbukutamu.php">[Lihat Buku Tamu]</a></td>

</tr>
</table>
<p>&nbsp;</p>
</body>
</html>
//SIMPAN
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/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>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$a=$_POST ['nama'];
$b=$_POST ['email'];
$c=$_POST ['pesan'];
$perintah = "insert into buku_tamu values('6','$a','$b','$c')";
$simpan =mysql_query($perintah) or die (mysql_error());
if($simpan){
echo"<script>
alert ('Data telah tersimpan');
location.href ='tambahbukutamu.php';
</script>";
}
else{
echo "gagal";
}
?>
</body>
</html>
//HAPUS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/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>Untitled Document</title>
</head>
<body>
<?php
$koneksi = mysql_connect("localhost","root","")or die (mysql_error());
mysql_select_db("db_berita");
$a=$_GET['id'];
$qry=mysql_query("DELETE FROM buku_tamu WHERE id = '$a'");
if ($qry)
echo"<meta http-equiv='refresh' content='0; url=tampilbukutamu.php'>";
else
echo"gagal";
?>
</body>
</html>
//EDIT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/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>Untitled Document</title>
</head>
<body>
<?php
$koneksi = mysql_connect("localhost","root","")or die (mysql_error());
mysql_select_db("db_berita");
$tampil= "SELECT * FROM buku_tamu WHERE id ='".$_GET ['id']."'";
$query = mysql_query ($tampil) or die ("gagal".mysql_error());
$row=mysql_fetch_array($query);
$a=$row['id'];
$b=$row['nama'];
$c=$row['email'];
$d=$row['pesan'];
?>
<form id="form1" name="form1" method="post" action="updatebukutamu.php">
<table width="64%" border="0" align="center">
<tr>
<td colspan="2" align="center" bgcolor="#FFFF99"><h2 style="font: 'Courier N
ew', Courier, monospace ; color :#F36">EDIT BUKU TAMU</h2></td>
</tr>
<tr>
<td>Id Buku Tamu </td>
<td><?php echo $a;?></td>
</tr>
<tr>
<td>Nama </td>
<td><input type = "text" name = "nama" id="nama" value="<?php echo $b;?>"/><
/td>
</tr>
<tr>
<td>Email </td>
<td><input type = "text" name = "email" id="email" value="<?php echo $c;?>"/
></td>
</tr>
<tr>
<td>Pesan</td>
<td> <textarea name ="pesan" id="pesan" cols="45" rows="5" ><?php echo $d;?>
</textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="update" id="update" value="UPDATE" />
<input type="reset" name="cancel" id="cancel" value="CANCEL"/></td>
</tr>
</table>
</form>
</body>
</html>
//UPDATE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/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>Untitled Document</title>
</head>

<body>
<?php
$koneksi = mysql_connect("localhost","root","")or die (mysql_error());
mysql_select_db("db_berita");
$a=$_POST ['id'];
$b=$_POST ['nama'];
$c=$_POST ['email'];
$d=$_POST ['pesan'];
$ubah="update buku_tamu set nama='$b',email='$c',pesan='$d' where id ='$a'";
mysql_query($ubah);
echo "<meta http-equiv='refresh' content='0 url=tampilbukutamu.php'>";
?>
</body>
</html>
//TAMPIL
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/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>Untitled Document</title>
</head>
<body>
<?php
$koneksi = mysql_connect("localhost","root","")or die (mysql_error());
mysql_select_db("db_berita");
$tampil = "SELECT *FROM buku_tamu ORDER BY id";
$query = mysql_query ($tampil) or die ("gagal".mysql_error());
$jumlah = mysql_num_rows($query)
?>
<table width="79%" border="1" style="border:#000" align="center">
<tr>
<td colspan="6" align="center"><h1><b>DATA BUKU TAMU </b> </h1></td>
</tr>
<tr align="center" bgcolor="#0066FF">
<td width="7%"><b>No</b></td>
<td width="15%"><b>Nama</b></td>
<td width="19%"><b>Email</b></td>
<td width="22%"><b>Pesan</b></td>
<td colspan ="2"><b>Action </b></td>
</tr>
<?php
while ($row=mysql_fetch_array($query))
{
$a=$row['id'];
$b=$row['nama'];
$c=$row['email'];
$d=$row['pesan'];
?>
<tr align="center">
<td><?php echo $a;?></td>
<td><?php echo $b;?></td>
<td><?php echo $c;?></td>
<td><?php echo $d;?></td>
<td width="23%"><a href="hapusbukutamu.php ?id =<?=$a;?>" onclick ="return conf
irm('Anda yakin ingin menghapus ini ?');">HAPUS </a></td>
<td width="14%"><a href="editbukutamu.php? id =<?=$a;?>">EDIT</a></td>
</tr>
<?php } ?>

<tr>
<td colspan="6" >Jumlah Record :<?php echo $jumlah;?></td>
</tr>
</table>
</body>
</html>

Vous aimerez peut-être aussi