/The following is a rework of the original work done by Brandon Schnell. I have made some modification and corrected a few errors./
//Database connection.
$connect=mysql_connect("localhost","user","password") or die (mysql_error());
$database="database";
$select = mysql_select_db($database, $connect) or die (mysql_error());
//Substite the user $table and $column for your table and column names.
$field_result = mysql_query("DESCRIBE $table $column");
$field_row = mysql_fetch_array($field_result);
if(stristr($field_row["Type"],"enum")){
echo "<SELECT NAME=\"", $field_row["Field"], "\">\n";
$array = explode("'",$field_row["Type"]);
$x = 1;
while ($array[$x]){
echo "<OPTION ";
//If you do not like to have a pre-selected selection you can take out this entire if statment.
if(($data_row[$field_row["Field"]] == $array[$x]) || (!isset($id) && ($field_row["Default"] == $array[$x]))){
echo "SELECTED ";
}
echo "VALUE=\"",$array[$x],"\">",$array[$x],"</OPTION>\n";
$x+=2;
}
echo "</SELECT>";
}
mysql_free_result($field_result)
mysql_close($connect);
?>