Gossamer Forum
Home : Products : DBMan : Customization :

Re: Drop down list of users

Quote Reply
Re: Drop down list of users In reply to
You could try this:

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





Subject Author Views Date
Thread Drop down list of users web dog 7776 Aug 30, 1999, 9:37 PM
Thread Re: Drop down list of users
JPDeni 7681 Aug 31, 1999, 10:09 AM
Thread Re: [JPDeni] Drop down list of users
chronisca 7506 Jun 25, 2003, 9:34 AM
Post Re: [chronisca] Drop down list of users
joematt 7498 Jun 25, 2003, 1:00 PM
Post Re: Drop down list of users
web dog 7624 Aug 31, 1999, 1:38 PM
Post Re: Drop down list of users
JPDeni 7644 Aug 31, 1999, 2:02 PM
Post Re: Drop down list of users
web dog 7673 Aug 31, 1999, 2:14 PM
Thread Re: Drop down list of users
JPDeni 7631 Aug 31, 1999, 2:31 PM
Thread Re: Drop down list of users
elettrone 7637 Aug 29, 2000, 12:35 PM
Thread Re: Drop down list of users
LoisC 7637 Aug 29, 2000, 6:18 PM
Thread Drop down list of users
elettrone 7644 Aug 30, 2000, 12:39 AM
Thread Re: Drop down list of users
LoisC 7615 Aug 30, 2000, 12:54 PM
Thread Re: Drop down list of users
elettrone 7601 Aug 30, 2000, 3:08 PM
Thread Re: Drop down list of users
LoisC 7606 Aug 30, 2000, 8:16 PM
Post Re: Drop down list of users
elettrone 7602 Aug 31, 2000, 12:43 AM