> 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!
I'm missing something, I guess, but using what you've got:
my $html_buffer = "<select name='list'>\n";
> my @data;
> while(@data = $sth->fetchrow_array()) {
> # $value1 = $data[0];
> # $value2 = $data[1];
$html_buffer .= "\t<option value='$data[0]">$data[1]</option>\n";
> }
> $html_buffer.="</select>\n";
lee
Obligatory perl schmutter sig:
perl -e "while (1){rand>0.5 ? print'\\' : print'/'}"
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web