gpt4 book ai didi

javascript - 选择html表的一些行,并在单击链接时将所选行的一列的值发送到另一个php页面

转载 作者:行者123 更新时间:2023-11-29 15:44:40 25 4
gpt4 key购买 nike

我需要选择 html 表的某些行,并在单击链接时将所选行的一列的值发送到另一个 php 页面。怎样才能做到呢?

使用表单,我可以将值存储在表单元素数组中,并且可以在单击提交按钮时发送到 php 数组。但在这种情况下它必须通过链接。

<?php 
$query2="select * from products";
$result2=mysqli_query($connection, $query2);
?>
<table>
<thead>
<tr>
<th><input type="checkbox" id="0" /></th>
<th>Item</th>
<th>Date</th>
<th>Type</th>
<th>Price</th>
<th>SKU</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while($row2=mysqli_fetch_array($result2))
{
?>
<tr>
<td><input type="checkbox" id="<?php $i; ?>" name="check['<?php echo $i; ?>']" value="<?php echo $row2['id']; ?>"/></td>
<td>$row2['item']</td>
<td>$row2['date']/td>
<td>$row2['type']</td>
<td>$row2['price']</td>
<td>$row2['sku']</td>
<td>$row2['description']</td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
<a href="index.php?page=reviewselecteditems">Review Selected Items</a>

我想将所选行的“项目”列值存储在变量中,并且需要将其传递到另一个 php 文件,在该文件中我想从数据库中获取所选项目的所有相关详细信息(如金额、税费等)并显示它在 html 表中。

最佳答案

在 id 属性中设置产品 id,然后单击“审核”按钮,将 GET 方法中的这些 id 发送到下一页,然后用户 $_GET 检索这些 id 并从这些 id 执行用于获取特定产品的 sql 查询

它将重定向类似这样的内容:

http://localhost/yourpage?id=1,2,3

获取此 ID 并分解它们。

关于javascript - 选择html表的一些行,并在单击链接时将所选行的一列的值发送到另一个php页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57200366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com