-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