<form name="myForm" action="doControlAcc.php" method="post" onsubmit="return validateForm(this);">
<table cellpadding="0" cellspacing="0" border="20" class="display" id="acc" width="200">
<thead>
<tr><h2>Accessories summary</h2></tr>
<tr>
<th>Type</th>
<th>Currently - Ex Factory</th>
<th>Minimum Required Stock</th>
<th>Update by</th>
<th>Last update</th>
<th>Re-Stock Amount</th>
<th>Stock Out</th>
</tr>
</thead>
<tbody>
<?php
$accessories = array()
$query = "SELECT description, current_stock, min_required_stock, c_ex_factory, last_update from Accessories”;
$result= mysqli_query($link, $query) or die(mysqli_error($link));
$row = mysqli_fetch_array($result);
while($row = mysqli_fetch_array($result)){
$order = $row['c_ex_factory'] - $row['min_required_stock'];
if ($order < 0){
$order = $row['min_required_stock']-$row['c_ex_factory'];
$color = "#FF0000";
}else{
$order = 0;
$color = "#00FF00";
}
?>
<tr>
<td name="accessories[]" id="accessories" value=”<?php echo $row['description'] ?>” <?php echo in_array($row['description', $ accessories) > <?php echo $row['description']; ?> </td>
<td align="center" name="accessories[]" id="accessories" value=”<?php echo $row[''c_ex_factory '] ?>” <?php echo in_array($row[''c_ex_factory ', $ accessories) > <?php echo $row['c_ex_factory']; ?> </td>
<td align="center" name="accessories[]" id="accessories" value=”<?php echo $row[''min_required_stock '] ?>” <?php echo in_array($row[''min_required_stock ', $ accessories) > <?php echo $row['min_required_stock']; ?> </td>
<td align="center" name="accessories[]" id="accessories" value=”<?php echo $row[' name '] ?>” <?php echo in_array($row[' name ', $ accessories) > <?php echo $row['name']; ?> </td>
<td align="center" name="accessories[]"id="accessories" value=”<?php echo $row['description'] ?>” <?php echo in_array($row['description', $ accessories) > <?php echo $row['up_when']; ?> </td>
<td align="center" name="accessories[]" bgcolor="<?php echo $color; ?>" id="accessories" <?php echo in_array($row[' re_stock ', $ accessories) > <input type="text" size="5" name="re_stock" value=" <?php echo $order ?>"/> </td>
<td align="center" name="accessories[]"id="accessories" <?php echo in_array($row[' out_stock ', $ accessories) > <input type="text" size="5" name="out_stock" value ="0"/></td>
</tr>
<?php
}
?>
<tr>
<td> </td>
<td> </td>
<td></td> <td></td> <td></td>
<td><button data-theme="b" id="submit" type="submit">Send order</button></td>
</tr>
</tbody>
</table>
</form>
您好,我是网络编程新手。上面的代码将从数据库中获取数据以在 PHP 中创建一个表,然后它将用户输入的缺货和补货发送到 doControlAcc.php 文件。我面临的问题是我需要创建多个输入行,以便用户可以为不同的产品输入缺货和补货。而且我不知道如何在填写表格后将这些多行传递给 doControlAcc.php 文件。(即如何访问 doControlAcc.php 中的附件数组?)。
感谢您的帮助。