【发布时间】:2021-10-23 12:07:42
【问题描述】:
它是一个产品的简单 POS 系统。但现在我必须扩展多个产品。它的工作原理就像当我选择多个产品时,它会显示一个单独的框,其中写入了所选产品名称,同时还有一个输入数量框。是否可以通过 jquery 或 php 进行?如果有人帮助我整理一下,那将是一个很大的帮助
<form method="POST" style="width:60%;margin-left:200px">
<div class="form-group">
<label>Choose Product:</label>
<select name="product_id" class="form-control" class="select" id="select_items" multiple >
<option disabled selected>-- Select Product --</option>
<!-- to retrive data from database and show into dropdown -->
<?php
$db = mysqli_connect('localhost', 'root', '', 'login');
$records = mysqli_query($db, "SELECT * From products where deleted=0"); // Use select query here
while($data = mysqli_fetch_array($records))
{
echo "<option value=". $data['id'] ." >" .$data['name'] ." </option>"; // displaying data in option menu
}
?>
</select>
<label> Quantity: </label>
<input type="text" name="quantity" class="form-control" ID="txtName" placeholder="Enter Quantity" required="" />
</div>
<button class="btn" name="submit-product" type="submit" ID="btnClick" >Submit</button>
</form>
【问题讨论】:
标签: javascript php jquery mysql