我试图在 html 页面中放置一个从 mysql 生成的下拉列表,问题是这段代码在 php 页面中工作正常,但在 html 页面中没有,我已将它放在 php 标记中但没有显示任何内容,我将不胜感激这里的任何帮助都是我的代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add Qustions</title>
</head>
<body>
<form action="saveQ.php" method="post" >
<br />
<?php $connectdb = mysql_connect('localhost','root','sara') or die ("Not Connect");
if (!$connectdb)
{
die('Could not connect :'. mysql_errno());
}
$selestdb = mysql_select_db('iexa', $connectdb) or die ("not selected database");
$qu = mysql_query("SELECT ID,Name FROM Course ORDER BY ID asc") or die ("mysql error");
echo "Choose the course that you want to create the test for : <br /> ";
echo " <select name='courseID' >Course</option>";
echo "<option value=0>Course </option>";
$curvalue=2;
while ($row = mysql_fetch_assoc($qu)){
echo '<option value="' .$row[ID].'">' .$row[ID].' ' .$row[Name].'</option>';
$curvalue = $curvalue+1;
}
echo "</select> "; ?>
<br />
/// some other unrelated code here
<input type="submit" value="Save Question" />
</form>
</body>
</html>