forked from esjoo/SchedLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query_for_insertChemical.php
43 lines (36 loc) · 1.65 KB
/
query_for_insertChemical.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!-- Chemicals -->
<link rel="stylesheet" type="text/css" href="bootstrap-select.min.css">
<script src="bootstrap-select.min.js"></script>
<label for="chemical">Chemicals & Dosages:</label>
<br>
<div class="form-group form-inline" id="chemicals">
<select class="selectpicker" placeholder="Chemical" name="chemical" data-live-search="true">
<?php
include 'db.php';
$result = mysqli_query($conn,"SELECT * FROM Supplement");
while($row = $result->fetch_assoc()){
$catID = $row['SupID'];
$catName = $row['SupName'];
echo "<option value='$catID'>$catName</option>";
echo '<br>';
}
include 'closeDB.php';
?>
</select>
<input type="number" class="form-control" name="dosage" placeholder="dosage" />
</div>
<button class="btn btn-primary" id="addLine">ADD</button>
<script type="text/javascript">
/* 新增检测时间 */
$("#addLine").click(function() {
var htm = "";
htm += "<div class='form-group form-inline' id='chemicals'>";
htm += "<select class='selectpicker' placeholder='Chemical' name='chemical' data-live-search='true'>";
htm += "";
htm += "</select>";
htm += "<input type='number' class='form-control' name='dosage' placeholder='dosage' />";
htm += "</div>";
$('#chemicals').append(htm);
});
</script>
<br>