我正在开发一个php的电子商务项目。除了一件事" cart.php"外,其余的事情已经完成。在这个"购物车"以下项目显示在表格中:产品图像,数量和价格。在数量列中有一个下拉列表,其中填充了1到10之间的数字。
在此,我想" 显示存储在表格中的产品数量,以显示为选定数量"下拉列表。我将如何实现这一目标?
以下是我的代码:
$pickrecs = "SELECT t_ordid, DATE_FORMAT(tord_dt,'%d-%m-%Y') as label_date, file_path, file_name, lbl_qty FROM ord where uid = '{$getid}'";
$result = mysqli_query($connection, $pickrecs); ?>
<table id='display'>
<thead>
<tr>
<th>Product</th>
<th>Creation Date</th>
<th>Labels</th>
<th>Total Price ( )</th>
<th></th>
</tr>
</thead>
<?php while($row = mysqli_fetch_assoc($result)){ ?>
<tbody>
<tr>
<td style="display:none;"><?php echo $row["t_ordid"] ?></td>
<td><img src="<?php echo $row['file_path'] ?>" alt="" style="width:61px; height:54px" /></td>
<td><?php echo $row["label_date"] ?></td>
<td>
<?php
$pickrecs = "SELECT r.rt_qty, r.rt_cost FROM rm as r join fy as f on r.fin_yr = f.fyear where f.status='A'";
$rtlist = mysqli_query($connection, $pickrecs);
echo "<select id='rtcrt' name='rtcrt' value='' class='rdd'>";
while($rtlistarr = mysqli_fetch_assoc($rtlist)){
//echo "<option value = $rtlistarr[rt_qty]>$rtlistarr[rt_qty]</option>";
echo "<option value = $row[lbl_qty]>$rtlistarr[rt_qty]</option>";
}
echo "</select>";
?>
<?php echo $_POST['rtcrt'] = $row['lbl_qty'] ?>
</td>
<td><input type="text" name="i-cost" value="5.95" readonly class="icost"></td>
</tr>
</tbody>
<?php } ?>
</table>