Try this on for size
void write_option(string label, string value, string current) {
write("<option value='" + value + "'");
if(value == current)
write(" selected");
writeln(">" + entity_encode(label) + "</option>");
}
void numeric_dropdown(string pref, string fail, string message...