PHP 在选择动态保管箱后将变量传递到下一页


PHP Pass variable to next page after dynamic dropbox selected

我创建了以下代码,它使下拉列表能够从sql db中获取所有值,它能够获取下拉值,但是我无法将值选择到下一个php页面

  <?php
$link = mysql_connect('www.xxxxxxxx.com', 'xxxxxxx', 'xxxxxxx');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxxxxxxxxxxxxxxxx", $link);
function print_dropdown($query)
{
$queried = mysql_query($query);
$menu = '<select name="Topic">';
while ($result = mysql_fetch_array($queried)) {
$topic = htmlspecialchars($result['topic']);
$menu .= '<option value="' . $topic .'">' . $topic . '</option>';
}
$menu .= '</select>';
return $menu;
}

echo print_dropdown("SELECT topic FROM learning_outcome");
?>

我使用会话和缓存从下拉列表中发送所选值,但下一页的输出为空

通过使用 $_POST['Topic'] 修复