-1
我正在开发一个销售点项目。我想选择一个产品在另一个领域回应产品价格。我无法找到一种做法。这里是我的代码php从数据库中选择并填写多个字段
<?php
include('../connect.php');
$result = $db->prepare("SELECT * FROM products");
$result->bindParam(':userid', $res);
$result->execute();
?>
<form>
<select>
<?php
for ($i = 0; $row = $result->fetch(); $i++) {
?>
<option value="<?php echo $row['product_id'];?>">
<?php echo $row['product_code']; ?>
-
<?php echo $row['gen_name']; ?>
</option>
<?php } ?>
</select>
<input type="number" name="qty" min="1" placeholder="Qty" autocomplete="off" style="width: 68px; height:30px; padding-top:6px; padding- bottom: 4px; margin-right: 4px; font-size:15px;"/required>
<input type="number" name="pc" max="25" placeholder="disc" autocomplete="off" style="width: 68px; height:30px; padding-top:6px; padding-bottom: 4px; margin-right: 4px; font-size:15px;" />
<input type="number" name="price" max="25" value="price goes here " style="width: 68px; height:30px; padding-top:6px; padding-bottom: 4px; margin-right: 4px; font-size:15px;" />
<input type="hidden" name="date" value="<?php echo date('m/d/y'); ?>"/>
</form>
是否有错误出现? – Swellar
我只注意到你绑定了一个不在查询中的参数。 – Swellar
哦,并避免使用内联的css,特别是如果它很多 – Swellar