如何获取从mysql数据库填充的php中选择的值
//function for dropdown
function getDropDown( $name, $table, $code, $desc )
{
$query = "SELECT $code, $desc FROM $table";
echo "<select name=\"$name\">";
echo '<option> Select One </option>';
connect(); //connects to mysql
$result = mysql_query( $query );`enter code here`
if( !$result ) die ( "error" . mysql_error() );
$foundRows = mysql_numrows ( $result );
//loop to populate dropdown
for( $row = 0; $row < $foundRows; ++$row)
{
list( $c, $d ) = mysql_fetch_row( $result );
echo "<option name= value=\"$c\">$d</option>";
}
echo "</select>";
}
使用选择?