2013-06-27 51 views
-4

我有一個包含此字段的PHP頁面:PHP鏈接調用另一個PHP頁面

<a href src='delcat.php'>Delete</a> 

我希望當我按下Delete(刪除)來調用delcat.php併發送類別ID是在一個領域在同一張桌子裏。 任何人都可以幫我達到這個好嗎? 這裏我的完整表的代碼:

<table border="0" align='center' class="styled-table"> 
      <tr class="thh"> 
    <th class="thh">Category Code</th> 
      <th class="thh">Category Name </th> 
      <th class="thh">Category IMage </th> 
      <th class="thh">Edit</th> 
    <th class="thh">Delete</th> 
      </tr> 
    <?php 
    for ($counter = 0; $row = mysql_fetch_row ($resultSet); $counter++) { 
     print ("<tr align='center' class='trh'>"); 
     print ("<td align='center' class='tdh'>$row[0]</td>"); 
     print ("<td align='center' class='tdh'>$row[1]</td>"); 
     print ("<td align='center' class='tdh'><img src='$row[2]' width='50' height='50'></td>"); 
     print ("<td align='center' class='tdh' width='50' align='center'><a href ='#'>Edit</a></td>"); 
     print ("<td align='center' class='tdh' width='50' align='center'><a href ='delcat.php'>Delete</a></td>"); 
     print("</tr>");  
     } 
+0

什麼是''? –

+0

'delete「;?>' – Carsten

+1

‘刪除我希望當我按下Delete(刪除)來調用delcat.php併發送類別ID是在同一個表中的字段’是曖昧也許你或其他人可以修改句子 –

回答

0

更改此:

<a href src='delcat.php'> 

要這樣:

<a href='delcat.php?categoryid=" . $row[0] . "'> 
+1

'A'標籤中的src'屬性? – Barmar

+0

@Barmar沒有看到;複製了OP的代碼並將var添加到最終。固定 - 謝謝。 –

0

可以在HREF發送類別ID作爲查詢字符串。

<a href='delcat.php?categoryId=".$row[0]."'>Delete</a> 

並在delcat.php頁面上使用$_GET['categoryId']進行檢索。

還有一種方法是你可以使用http_build_str

相關問題