2013-06-27 52 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

相关问题