我遇到了一个问题,我想重复自己的生活价值 选项= 1 选项2 = 2
$query = mysql_query("SELECT * FROM `Tijden-DB` WHERE klas='".$Klas."'");
while($row = mysql_fetch_array($query)){
$leraar = $row['Leraar'];
}
echo '
<html>
<form action="Afspraak2.php" method="post">
<select name="klas">
<option>'.$leraar.'</option>
</select><br />
</html>
';
有2行,但他只回复最后一行
答案 0 :(得分:2)
我认为您应该在按照以下方式重复记录时打印您的选项
<html>
<form action="Afspraak2.php" method="post">
<select name="klas">
<?php
$query = mysql_query("SELECT * FROM `Tijden-DB` WHERE klas='".$Klas."'");
while($row = mysql_fetch_array($query)){
echo '<option>'.$row['Leraar'].'</option>';
}
?>
</select><br />
</html>