所以我有一些php代码来将一个mysql表返回到一个下拉框中,如下所示:
$hostname = ""; //SET SERVER/HOSTNAME
$dbusername = ""; //SET DATABASE USERNAME
$dbname = ""; //SET DATABASE NAME
$dbpassword = ""; //SET DATABASE USERNAME
$link = mysqli_connect($hostname, $dbusername, $dbpassword, $dbname);
if (!$link)
{
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
$sql = "SELECT * FROM utility ORDER BY program_code";
if ($result = mysqli_query($link, $sql))
{
while ($row = mysqli_fetch_assoc($result))
{
$selectbox.='<option value=\"' . $row['program_code'] . '\">'
. $row['program_code'] . ' - ' . $row['rate'] . ' - ' . $row['term'] . '</option>';
}
$selectbox.='</select>';
mysqli_free_result($result);
echo $selectbox;
}
这很好用,然后我就把它加入我的表格中。My problem is when an option is selected, I need to get and return that value so I can pass it on to whatever else I am doing with the values from my form. 任何帮助是极大的赞赏。谢谢你。