کد 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>برنامه جامع رستوران</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-color: #CFC;
}
</style>
</head>
<body>
<div class="container">
<?php require "header.php" ?>
<?php
require("menu.php");
?>
<div id="rbody">
<table>
<thead>
<tr>
<th>نام موسسه</th>
<th>نوع فعاليت</th>
<th>نام مدير مسئول</th>
<th>تلفن</th>
<th>آدرس</th>
<th colspan="2">عمليات</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET['action']))
{
$action = addslashes($_GET['action']);
$id = intval($_GET['id']);
if ($action == 'del')
{
$sql = "DELETE FROM `etehadie` WHERE `id` = $id";
mysql_query($sql);
}
}
$sql = "SELECT * FROM `etehadie`";
$res = mysql_query($sql);
$c = 1;
while ($row = mysql_fetch_assoc($res))
{
if ($c)
echo '<tr class="tr_odd">';
else
echo '<tr class="tr_even">';
echo '<td>'.$row['title'].'</td>';
echo '<td>'.$row['activity'].'</td>';
echo '<td>'.$row['manager'].'</td>';
echo '<td>'.$row['phone'].'</td>';
echo '<td>'.nl2br($row['address']).'</td>';
echo '<td><a href="info.php?action=edit&id='.$row['id'].'">ويرايش</a></td>';
echo '<td><a href="?action=del&id='.$row['id'].'">حذف</a></td>';
echo '</tr>';
$c=!$c;
}
echo "<tr><td colspan=7><a href='info.php?action=new'>افزودن موسسه</a></td></tr>"
?>
</tr>
</table>
</div>
</div>
</body>
</html>
ممنون