php链接调用另一个php页面

时间:2013-06-27 10:16:21

标签: php

我有一个包含此字段的php页面:

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

我希望当我按下Delete来调用delcat.php并发送同一个表中字段中的categoryid。 任何人都可以帮我解决这个问题吗? 这里是我的完整表格代码:

<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>");       
      } 

2 个答案:

答案 0 :(得分:0)

改变这个:

<a href src='delcat.php'>

对此:

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

答案 1 :(得分:0)

您可以在href。

中将类别ID作为查询字符串发送
<a href='delcat.php?categoryId=".$row[0]."'>Delete</a>

并在delcat.php页面上使用$_GET['categoryId']进行检索。

还有一种方法是使用http_build_str