$sql1 = "SELECT c.comm FROM enquiry e JOIN comments c ON e.id = c.enquiryId where e.id = '$memberId' AND e.cmpId = '$companyId'";
$result1 = mysqli_query($conn, $sql1);
echo "<select class='form-control' name='comment'>";
while($row1 = mysqli_fetch_array($result1, MYSQLI_ASSOC)){
echo "
<option value='".$row1['comm']."'>".$row1['comm']."</option>
</select>";
}
答案 0 :(得分:3)
将结束</select>
标记放在while
循环之后。
答案 1 :(得分:1)
尝试编写select
标签,如下所示:
<select class="form-control" name="comment">
$sql1 = "SELECT c.comm FROM enquiry e JOIN comments c ON e.id = c.enquiryId where e.id = '$memberId' AND e.cmpId = '$companyId'";
$result1 = mysqli_query($conn, $sql1);
while($row1 = mysqli_fetch_array($result1, MYSQLI_ASSOC)){
echo "<option value='".$row1['comm']."'>".$row1['comm']."</option>
}
</select>