我有一个名为new_booking.php的页面和一个名为addmore.php的页面,我需要在new_booking.php内添加addmore.php,当我单击添加更多按钮时,它会添加一个动态下拉字段。这是我的代码的快照 </DIV><SCRIPT> function addMore() { $("<DIV>").load("addmore.php", function() { $("#product").append($(this).html()); }); } function deleteRow() { $('DIV.product-item').each(function(index, item){ jQuery(':checkbox', this).each(function () { if ($(this).is(':checked')) { $(item).remove(); } }); }); }</SCRIPT>现在的问题是,当我单击添加更多按钮时,它只是在下拉列表中添加了一个文本字段而没有数据库中的值。这是我的addmore.php代码的快照<DIV class="product-item float-clear" style="clear:both;"> <DIV class="float-left"><input type="checkbox" name="item_index[]" /></DIV> <DIV > <select class = "mdl-textfield__input" id="categories" name="roomtype[]" > <option value="">Choose Room Type</option> <?php $resultUser = mysqli_query($conn, "SELECT * FROM room_type "); //$NoRowStaff = mysqli_num_rows($resultStaff); if ($resultUser->num_rows > 0) // Loop through the query results, outputing the options one by one while($row = $resultUser->fetch_assoc()) { echo '<option value="'.$row['rt_id'].'">'.$row['type'].'</option>'; } ?> </select></DIV> <br><br> <DIV> <select class = "mdl-textfield__input" name="roomno" id="subcat" required> <option value="" selected>Choose Room number.... </option> </select></DIV> </DIV>我如何将数据库中的值追加到新添加的下拉字段中,以便每当我单击addmore按钮时,它就会附带数据库中的值?
1 回答
- 1 回答
- 0 关注
- 183 浏览
添加回答
举报
0/150
提交
取消