就像标题说的那样,我需要从下拉框中获取选定的值并将其分配给一个变量。
<?php
$host = "localhost";
$username = "root";
$pass = "";
$database = "database_camcalc";
$conn = mysql_connect($host, $username, $pass) or die (mysql_error());
mysql_select_db($database, $conn);
$query = "SELECT camera FROM camlist";
$result = mysql_query($query) or die (mysql_error());
$dropdown = "<select name='cameraDD' onchange='this.form.submit()'>";
while($row = mysql_fetch_assoc($result)) {
$dropdown .= "\r\n\<option value='{$row['camera']}'>{$row['camera']}</option>";
}
$dropdown .= "\r\n</select>";
echo ('<form method="POST">');
echo ($dropdown);
echo ('</form>');
?>
任何帮助,将不胜感激。