ODBiC Discussion Board

RE: Populate an Option list from and TXT file, Scott, 06-21-2005

Use the IMPORT command

by Roger Harris, June 22, 2005 12:38

<% IMPORT value FROM file.txt>
(... using whatever variable name you like for the "value", and the full local file system path and name for your text file.)

This will loop through all the lines in the file, assigning the text in each line to the "value" variable. Inside this loop, you can do whatever you need to with the $value$ variable. In your case, you could write a script that runs once to insert the values into a table (e.g. INSERT INTO table (column) VALUES ('$value$'), which you could then use in an OPTIONLIST command. Or, you could generate your pull-down directly from the text file (e.g. put a <SELECT NAME="..."> tag before the IMPORT loop, then inside the loop put <OPTION>$value$, then put </SELECT> after the ENDIMPORT).


Post Your Reply:

E-mail  optional

HTTP Link: 
Link text: 


Copyright ©1997-2003, Roger Harris. All rights reserved.