我正致力于从数据库中提取产品(针对每个产品ID名称类型价格)并希望在表格中显示这些数据并将ID作为链接。单击它时,它将打开一个新页面,其中有关该产品的描述包含该ID。
问题是,所有ID在点击时都会获得相同的链接。
include"connect.php";
$sql= "select * from products where NameP='$product'";
$dbRecords=mysql_query ($sql);
echo "<form method='post'>";
echo "<th><input type='submit' name='elimnate' value='Elimimar'/></th>";
echo "<table border='1' style='width:100%'>";
echo "<tr>";
echo "<td> </td>";
echo "<td> ID </td>";
echo "<td> </td>";
echo "<td> Price </td>";
echo "<td></td>";
echo "<td> Type </td>";
echo "<td> </td>";
echo "<td> Quantity </td>";
echo "<td></td>";
echo "<td> elimanate </td>";
echo "<td></td>";
echo "<td> order </td>";
echo "</tr>";
while ($arrPro = mysql_fetch_array($dbRecords))
{
echo "<tr>";
echo "<td>";
echo "<th> <a href='show.php?id=".$arrPro['id'] ."' >" . $arrPro['id'] . "</a></th>";
$_SESSION['idu']=$arrPro['id'];
echo "</td>";
echo "<td>";
echo "<th>" . $arrPro['price'] . "</th>";
echo "</td>";
echo "<td>";
echo "<th>" . $arrPro['type'] . "</th>";
echo "<td>";
echo "<th>".$arrPro['quantity']."</th>";
echo "</td>";
echo "<td>";
echo "<th>"."<input type='checkbox' name='id[]' id='chekbox'>"."</th>";
echo "</td>";
echo "<td>";
echo "<th>"."<input type='submit' name='id[]' id='button'>"."</th>";
echo "</td>";
echo "</tr>";
}
echo"</table>";
echo "</frame>";