【发布时间】:2018-11-15 22:51:57
【问题描述】:
我想在我的 while 循环中有一个 <br>。
如果我添加<br>,我会为单个项目添加<br>,我想要的是在<img> 和<button> 之间只显示<br>。所以不是每个按钮都分开。有人可以帮我吗?
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc())
{
?>
<img src="<?php echo $result_question['img'];?>">
<input type="button" id="<?php echo $row["answer_id"];?>" next_question_id="<?php echo $row["next_question_id"];?>" value="<?php echo $row["answer_text"];?>" onclick=myFunction2((this.id));>
<?php
}
}
$conn->close();
?>
【问题讨论】:
-
对不起。我无法理解您的要求。您能否详细说明,以便我可以提供帮助?
-
在打印前检查
$row["answer_text"]或$row["answer_id"]是否符合您想要的文本或ID
;
标签: php html loops while-loop