Hello Mark,
That should be pretty simple, actually I do it, and probably have a code
sample somewhere here...

Evidently you are doing a cgi, so I would at the beginning of the cgi call
for a connect to your db.
Then start your HTML, then make your select on the page.
print qq{<select name="list">};
now get your query results here
while (@data = $sth->fetchrow_array()) {
   print qq{<option value=$data[0]>$data[0]};
}
print qq{</select>};
I don't know what you are getting back from your db query, so you will have
to investigate that.

Do you have the Perl DBI book?

If not, it is a great assistant.

Yell if you aren't having any luck,

Scott




-----Original Message-----
From: Mark Bergeron [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 2:33 PM
To: [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Drop Down list


Hello group,
I have really tried to to populate a dropdown list with values from a
database. In the past I've worked around this problem and it's not been an
issue. But now, the time has come to s%$t or get off the pot.

Has anyone a little advice on this procedure?

Let's say I have the values from the dB stuffed into @data. 

my @data;
while(@data = $sth->fetchrow_array()) {
    $value1 = $data[0];
    $value2 = $data[1];
}

What would be the best way to create something like:

<select name="list"
<option value="$value1">$value2</option>
</select> 

but, do it for every record in the table so you could navigate to each and
every one. I know foreach figures into this. If I could only get this down
I'd be well on my way to being a happy, well adjusted Perl programmer!

Humbled,
Mark Bergeron
/~_. _ | _ _  _  _ 
\_/|(_||| | |(_)| |
     _|
___________________________________________________
GO.com Mail                                    
Get Your Free, Private E-mail at http://mail.go.com


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to