选择动态dropbox后,PHP将变量传递到下一页

选择动态dropbox后,PHP将变量传递到下一页,php,sql,Php,Sql,我创建了下面的代码,它使下拉列表能够从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)

我创建了下面的代码,它使下拉列表能够从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");
?>

使用$\u POST['Topic']修复

我使用会话和缓存从下拉列表中发送所选值
您是如何做到的?会话://第1页$\u会话['varname']=$var\u值//在第2页$var_value=$_会话['varname'];Cookie://一页1$\u Cookie['varname']=$var\u值//在第2页$var_value=$_COOKIE['varname'];通过使用$\u POST['Topic']修复