我正在尝试在表格中的数据周围放置一个链接。因此,如果用户单击该链接,它会将他们带到该项目的编辑页面。每次我把代码中的数据从表中消失。这是我正在处理的页面的代码:
我正在尝试将可点击的数据放在表格代码的开头
<?php include '../view/header.php'; ?>
<div id="main">
<h1>Product List</h1>
<div id="content">
<!-- display a table of products -->
<h2><?php echo $name; ?></h2>
<table>
<tr>
<th>Code</th>
<th>Name</th>
<th class="right">Version</th>
<th> </th>
</tr>
<?php foreach ($products as $product) : ?>
<tr>
<td> <a href="?action=view_product&product_id=<?php echo $product['productCode']; ?>"</a></td>
<td><?php echo $product['name']; ?></td>
<td class="right"><?php echo $product['version']; ?></td>
<td><form action="." method="post">
<input type="hidden" name="action"
value="delete_product" />
<input type="hidden" name="productCode"
value="<?php echo $product['productCode']; ?>" />
<input type="submit" value="Delete" />
</form></td>
</tr>
<?php endforeach; ?>
</table>
<p><a href="?action=show_add_form">Add Product</a></p>
</br>
</div>
</div>
<?php include '../view/footer.php'; ?>