<?php require('system/login.php');  ?>
<?php require_once('../Connections/BE2.php'); ?>
<?php

if(isset($_GET['del_id']) && ( $_GET['del_id']>0 )){
mysql_select_db($database_BE2, $BE2);
$delete_SQL = sprintf("DELETE FROM mdat WHERE m0='%s'",$_GET['del_id']);
$Rt2 = mysql_query($delete_SQL, $BE2) or die(mysql_error());
}
$currentPage = $_SERVER["PHP_SELF"];

$startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2;

mysql_select_db($database_BE2, $BE2);
$query_Rt2 = "SELECT * FROM mdat ORDER BY m3";
$Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error());
$row_Rt2 = mysql_fetch_assoc($Rt2);
 
?>
  
  <table width="772" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <th width="11%" nowrap="nowrap" class="font2">ID</th>
      <th width="35%" nowrap="nowrap" class="font2">選單名稱</th>
      <th width="35%" nowrap="nowrap" class="font2">選單連結</th>
      <th width="5%" nowrap="nowrap" class="font2">使用</th>
      <th width="5%" nowrap="nowrap" class="font2">排列序</th>
      <th nowrap="nowrap" class="font2">刪除</th>
    </tr>
    <?php 
	  
	  do { ?>
    <tr>
      <td align="center" class="font3"><a href="main.php?act=homemenu_edit&amp;id=<?php echo $row_Rt2['m0']; ?>"><img src="images/edit.png" alt="修改項目名稱" width="16" height="16" border="0" /></a></td>
      <td align="center" class="font3"><?php echo $row_Rt2['m1']; ?></td>
      <td class="font3"><?php echo $row_Rt2['m2']; ?></td>
      <td align="center" class="font3"><?php echo $row_Rt2['m4']; ?></td>
      <td align="center" class="font3"><?php echo $row_Rt2['m3']; ?></td>
      <td width="8%" align="center" class="font3"><a href="javascript:if(confirm('確實要刪除嗎?'))location='<? echo 'main.php?act=homemenu&del_id='.$row_Rt2['m0'] ;?>'"><img src="images/del.png" alt="刪除項目" width="16" height="16" border="0"/></a></td>
    </tr>
    <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); 
	    
	  ?>
 
    <tr>
      <td colspan="7"></td>
    
    </tr>
  </table>

<?php
mysql_free_result($Rt2);
?>
