It would just be a combination of
sub build_select_field_from_db and the part that builds the select field in
sub admin_display.
Code:
sub build_select_field_from_password {
# --------------------------------------------------------
# Builds a SELECT field from the database.
my ($column, $value, $name) = @_;
my (@fields, $field, @selectfields, @lines, $line, $output);
$name || ($name = $column);
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS;
LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
push (@selectfields, $data[0]);
}
$output = qq|<SELECT NAME="$name"><OPTION>---|;
foreach $field (sort @selectfields) {
($field eq $value) ?
($output .= "<OPTION SELECTED>$field") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
I'm not sure what use this would be unless you have a really huge database and it's taking too long to build the select field from the database file.
JPD
----------------------------------------------------
JPDeni's DBMan-ual How to
ask questions the smart way.