我什至不知道要问什么。
我有这个代码
$limitValue = $_POST['count'];
$type = $_POST['topic'];
$qType = join("','", $type);
$sql = "SELECT question_id, questionType, question, answerA, answerB, answerC, answerD
FROM questions
WHERE questionType IN ('$qType')
ORDER BY RAND() LIMIT $limitValue";
$result = mysqli_query($link, $sql);
if (mysqli_num_rows($result) > 0) {
// output data from each row
while ($row = mysqli_fetch_array($result)) {
$qID = $row['question_id'];
$a = $row['answerA'];
$b = $row['answerB'];
$c = $row['answerC'];
$d = $row['answerD'];
$rA = $row['rightAnswer'];
echo "QID: " . $row["question_id"]. "<br>".
"Question Type: " . $row["questionType"]. "<br><br>" .
"Question: " . $row["question"]. "<br><br><br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='A' > A. <span><span> $a \r\n<br><br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='B' > B. <span><span> $b \r\n<br><br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='C' > C. <span><span> $c \r\n<br><br>";
echo "<input type = 'Radio' Name = 'Answer[$qID]' value ='D' > D. <span><span> $d \r\n<br><br><br><hr>";
/* echo "A) " .$row["answerA"]. "<br>" . "B) " .$row["answerB"]. "<br>" . "C) " .$row["answerC"]. "<br>" . "D) " .$row["answerD"]. "<br><br><br>";*/
}
}
mysqli_free_result($result);
echo "<input name='submit' type='submit' value='See Results'>\r\n";
mysqli_close($link);
?>
当输出太长时,会将其放在单选按钮旁边的下一行。就像您在此处看到的选项A一样。
答案 0 :(得分:0)
它将推送到下一行,因为您在<span><span>
旁输入了A.
。尝试使用<span><span>
而不是
。这将为您提供不间断的空间。
答案 1 :(得分:0)
问题出在数据库中。有些人将内容输入数据库,这会导致段落中断(
)。所以代码很好,只是数据才是问题。感谢您的帮助。