File: /home/suanchonac/public_html/skfood/addmin.php
<?php include "connect.php"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/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>
<script>
function confirmDelete(pid) { // ฟังก์ชันจะถูกเรียกถ ้าผู ้ใช ้คลิกที่ link ลบ
var ans = confirm("ต้องการลบสินค้ารหัส : " + pid); // แสดงกล่องถามผู ้ใช ้
if (ans==true) // ถ ้าผู ้ใช ้กด OK จะเข ้าเงื่อนไขนี้
document.location = "delete.php?id_menu=" + pid; // ส่งรหัสสินค ้าไปให ้ไฟล์ delete.php
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th bgcolor="#f7941d" scope="col"><img src="img/bn.jpg" width="1910" height="350" /></th>
  </tr>
  <tr>
    <td bgcolor="#f7941d"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="11%" align="left" valign="top" scope="col"><a href="index.php"><img src="img/M1.png" width="200" height="45" /></a></th>
        <th width="11%" align="left" scope="col"><a href="menu.php"><img src="img/M2.png" width="200" height="45" /></a></th>
        <th width="11%" align="left" valign="top" scope="col"><a href="hotmenu.php"><img src="img/M3.png" width="200" height="45" /></a></th>
        <th width="11%" align="left" scope="col"><a href="user.php"><img src="img/M4.png" width="200" height="45" /></a></th>
        <th width="56%" align="left" valign="top" scope="col"><a href="login.php"><img src="img/M5.png" width="200" height="45" /></a></th>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#f7941d">รายการอาหาร ที่มีอยู่ในฐานข้อมูล</td>
  </tr>
  <tr>
    <td bgcolor="#f7941d"> </td>
  </tr>
  <tr>
    <td bgcolor="#f7941d"><a href="add_menu.php">พิ่มเมนูอาหาร</a></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="col"><?php
$stmt = $pdo->prepare ("SELECT * FROM food");
$stmt->execute();
while ($row = $stmt->fetch()) {
echo "ที่: " . $row ["id_menu"] . "<br>";
echo "ชื่ออาหาร: " . $row ["name_menu"] . "<br>";
	echo "<a href='edit.php?id_menu=" . $row ["id_menu"] . "'>แก้ไข</a>";
	echo "<a href='#' onclick='confirmDelete(" . $row ["id_menu"] . ")'> ลบ</a>";
echo "<hr>\n";
}
?>
    </th>
  </tr>
  <tr>
    <td height="155" align="center" valign="middle" bgcolor="#CCCCCC"><p>COPYRIGHTS SKC. ALL RIGHTS RESERVED.</p>
    <p>addmin</p></td>
  </tr>
</table>
</body>
</html>