第二个echo语句打印时没有关闭</option>
标记。但正确打印其余代码。如果我检查HTML,文本Any Publisher ...将留在''单引号中。感谢
function getPublishers (){
$sql = "SELECT DISTINCT publisher FROM book ORDER BY publisher ASC";
$rs = mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_assoc($rs);
$tot_rows = mysql_num_rows($rs);
if($tot_rows>0){
echo "<select name=\"srch_publisher\" id=\"srch_publisher\>\n";
**echo "<option value\"\">Any Publisher…*</option>*\n";**
do{
echo "<option value=\"".$rows['publisher']."\">".$rows['publisher']."</option>";
} while($rows = mysql_fetch_assoc($rs));
echo "</select>";
}
mysql_free_result($rs);
}
答案 0 :(得分:0)
您在id="srch_publisher"
之后错过了结束引号:
echo "<select name=\"srch_publisher\" id=\"srch_publisher\>\n";
↑
missing closing quote (") at this position