Gossamer Forum
Home : Products : DBMan : Customization :

Select field from external text file

Quote Reply
Select field from external text file
I am using a snippet of code found in the thread:

Thread reference: http://gossamer-threads.com/p/002323
Topic: Select in default.cfg OR second db ??
Yokhannan - March 10, 2000

What this code does in pull in a select list from an external file. The code is:

|;
open(SELECT,"pteam.txt") || die "Can't open file";
@pteam_list = (<SELECT> );
close (SELECT);
print qq|<select name="PTeam">|;
foreach (@pteam_list) {
chomp $_;
print qq| <option>$rec{'PTeam'}</option>|;
print "$_\n";
}
print qq|</select>

With a note to keep a blank line as the first line in the file.

This works great for adding the records into the database, but when I modify the record it shows the original selection prior to every other option in the file :)

Can someone help me by giving me suggestions on how I can modify the code to prevent this. The list I'm using is very long, so I'd like to keep it in an external text file. It will then be easier to keep this field updated if necessary.

Any help is greatly appreciated.

Lois

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Subject Author Views Date
Thread Select field from external text file LoisC 10283 Feb 19, 2002, 12:21 AM
Thread Re: [LoisC] Select field from external text file
chmod 10152 Feb 19, 2002, 1:52 AM
Thread Re: [chmod] Select field from external text file
LoisC 10196 Feb 19, 2002, 2:16 AM
Thread Re: [LoisC] Select field from external text file
chmod 10088 Feb 19, 2002, 3:50 AM
Thread Re: [chmod] Select field from external text file
LoisC 10162 Feb 19, 2002, 10:29 AM
Thread Re: [LoisC] Select field from external text file
Watts 10173 Feb 19, 2002, 11:40 AM
Thread Re: [Watts] Select field from external text file
LoisC 10138 Feb 19, 2002, 9:11 PM
Thread Re: [LoisC] Select field from external text file
Watts 10099 Feb 20, 2002, 7:49 AM
Thread Re: [Watts] Select field from external text file
Paul 10165 Feb 20, 2002, 8:07 AM
Thread Re: [RedRum] Select field from external text file
LoisC 10070 Feb 20, 2002, 2:48 PM
Thread Re: [LoisC] Select field from external text file
dstamos 9790 Dec 14, 2005, 2:25 PM
Thread Re: [dstamos] Select field from external text file
LoisC 9819 Dec 14, 2005, 8:17 PM
Post Re: [LoisC] Select field from external text file
JPDeni 9828 Dec 15, 2005, 5:20 AM
Post Re: [LoisC] Select field from external text file
dstamos 9797 Dec 15, 2005, 9:12 AM