你好,我是使用PHP和HTML的新手,我想知道是否有人可以帮助并告诉我我的第二个下拉菜单出错了什么?我已经发布了第二个下拉菜单的代码。我无法弄清楚为什么我的$ _POST不适合我?任何帮助将不胜感激。
[insert_php]
$department = $_POST['department'];
$result2 = $wpdb->get_results("SELECT course FROM class WHERE department = $department;");
echo "
<form action='process.php' method='post'>
<select name='professor'>";
foreach($result2 as $result2){
{
echo "<option selected value='$result2->course'>$result2->course</option>";
}
}
echo" </select>
<input type='submit' value= 'Select' />
</form>";
[/insert_php]