You could try this:
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS;
$user_list = qq~<select name="username"><option>---</option>~;
LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
unless ($data[6]) {
push (@users,$data[0]);
}
}
foreach $user (sort @users) {
if ($rec{$db_cols[$auth_user_field]} eq $user) {
$user_list .= qq~<option value="$user" SELECTED>$user</option>\n~;
}
else {
$user_list .= qq~<option value="$user">$user</option>\n~;
}
}
$user_list .= "</select>";
Then use $user_list in the place where you want to place the select field.
------------------
JPD
Code:
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;
$user_list = qq~<select name="username"><option>---</option>~;
LINE: foreach $line (@lines) {
$line =~ /^#/ and next LINE;
$line =~ /^\s*$/ and next LINE;
chomp $line;
@data = split (/:/, $line);
unless ($data[6]) {
push (@users,$data[0]);
}
}
foreach $user (sort @users) {
if ($rec{$db_cols[$auth_user_field]} eq $user) {
$user_list .= qq~<option value="$user" SELECTED>$user</option>\n~;
}
else {
$user_list .= qq~<option value="$user">$user</option>\n~;
}
}
$user_list .= "</select>";
Then use $user_list in the place where you want to place the select field.
------------------
JPD