วันพุธที่ 15 สิงหาคม พ.ศ. 2555

โค้ด index.php


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body,td,th {
color: #00F;
}
    body {
background-color: #FFF;
}
    a {
font-family: Verdana, Geneva, sans-serif;
}
    a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
    </style>
</head>
<body>
<div><h1>สมุดเยี่ยม</h1></div>
<form action="add_data.php" method="post">
<table>
<tr>
<td>รายละเอียด</td>
<td><textarea name="g_detail"></textarea></td>
</tr>
<tr>
<td>ชื่อ</td>
<td><input type="text" name="g_name" /></td>
</tr>
<tr>
<td>อีเมล์</td>
<td><input type="text" name="g_email" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="submit" /></td>
</tr>
</table>
</form>
<hr/>
<table>
<?php
include('connect_db.php');
$number = 0;
$rs = mysql_query("SELECT * FROM guestbook ORDER BY g_id DESC");
while($value = mysql_fetch_array($rs)){
$number++;
?>
<div>#<?php echo $number;?></div>
<div>
<span><?php echo $value['g_detail'];?></span>
</div>
<div>
<span><b>Name :</b> <?php echo $value['g_name'];?></span>
<span><b>Email :</b> <?php echo $value['g_email'];?></span>
<span><b>Created : </b> <?php echo $value['g_date']; ?></span>
<span><a href="report_delete.php?g_id=<?php echo $value['g_id'];?>">แจ้งลบ</a></span>
</div>
<hr/>
<?php } ?>
</table>
<table width="161" border="0">
 <tr>
   <td colspan="3"><a href="index_manage.php">ติดต่อผู้ดูแลระบบ อาจารย์ปรีชา ปรือปรัง</a></td>
     </tr>
    </table>
</body>
</html>

ผลการรันโปรแกรม