Link to home
Start Free TrialLog in
Avatar of EvanL
EvanL

asked on

Populate Drop Down List with Values from CSV DB

I'm using Front Page 98 to create a webpage.  I need a Drop Down List to be populated with values from a .CSV database.  I use Perl 5 to write CGI scripts sucessfully on other pages on this same site.  Anyone know how to do this?
ASKER CERTIFIED SOLUTION
Avatar of sax
sax

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EvanL
EvanL

ASKER

I'm new to Perl 5 so lemme be specific so the code you post can reflect it.  The field name is "Last Name" in the .csv database and there are about 300 records there - each with a "Last Name" field filled.  So the drop down list would have to be filled with each record from the database.

I've increased the points so you will repost.. Thanks!
Avatar of EvanL

ASKER

Doh!  Also, what code appears in the .cgi file and which goes in the .html file?
I am assuming that each line in the file has one last name listed, as shown below:

SMith
Patrick

etc..

and you have enough knowledge of HTML that is being shown here.
============
The entire HTML file will have to generated by the perl script
===========
$inputdata = "csvfile";
open(DATA, $inputdata);

while (<DATA>) {
                    ($lastname) = split();
                    push $suppl, $lastname;
            }

;display the data as a drop down list
 ;print table

    print "<table>";
    print "<tr><td>Select the last name";
    print "<td><select name=\"lastname\">";
    foreach $element ($suppl) {
            print "<option value=$element>$element";
            print "\n";
        }
    print "</select></table>";          
       

-sax