嘿,我想隐藏一个我正在调用的值。它的ID值是。$ row [“ item_id”] ..如何实现呢?
$query = "SELECT * from itemtbl where username = '{$_SESSION['username']}'";
$result = mysqli_query($con,$query);
if ($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
echo "<tr><td>" . $row["item_name"]. "</td><td>" . $row["description"] . "</td><td>"
. $row["item_pic"]. "</td><td>" . $row["item_id"]. "</td><td>";
echo '<a href="studentinventoryedit.php?item_name='.$row['item_name'].'"><button title="edit" type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-pencil white"></span></button></a>';
echo '<a href="studentinventoryedit.php"><button title="delete"type="button" class="btn btn-default btn-sr"><span class="glyphicon glyphicon-trash white"></span></button></a>';
}
} else {
echo "</table>";
echo '<p class="a1"><b>You have no item. Please insert item</p>';
}
答案 0 :(得分:-1)
您可以将其分配给隐藏元素或tr行id属性,而不是将其放入td中。
<td><input type='hidden' value='" . $row["item_id"]. "' /></td>
另外,用tr代替td关闭回声