我有一个由foreach循环生成的表,而Im试图这样做,因此当用户刷新屏幕时,刷新后会将它们带到页面上的相同位置。我表的代码如下:
<table>
<tr>
<th>Name</th>
<th>Scanned</th>
</tr>
<?php
// Generate the picking table
foreach($picking_list as $product){
$product_name = $product['name'];
echo "<tr><td>";
echo $product_name;
if(!empty($product['barcode'])){
echo "<span>Barcode: " . $product['barcode'] . "</span>";
} else {
echo '<span id="red_text"><strong><i class="fas fa-exclamation-triangle"></i> Warning! Barcode missing! Please confirm stock manually.<strong></span>';
}
echo '</td><td id="scan_count">';
echo $product['scanned'] . '/' . $product['quantity'];
// Mark as scanned button. Popup confirmation and form submit
echo '<form onsubmit="return confirm(\'Do you want to mark all ' . $tools->cleanHyphens($product_name) . ' as scanned?\');" action="" method="POST">
<input type="hidden" name="scan_all">
<input type="hidden" name="product_id" value="' . $product['product_id'] . '">
<input type="submit" class="button" name="submit" value="Confirm All">
</form>';
echo "</tr>";
}
?>
</table>
为此的某些背景,该程序为仓库人员生成一个拣配清单,他们扫描产品条形码并将其与在那里的订单进行比较,并确认其是否为正确的物品,并且用户在扫描完产品后已经反馈了该物品条形码和页面刷新,它们希望位于相同的滚动位置。
任何帮助将不胜感激。