Thanks for all the help!
I had to read a few pages of Perl.
Had to place an error statement after the first if statement and
had to make my %s_project_labels = ();
And finally I removed the single quotes from the drop down menu values and
labels.
What a learning experience, but sure is worth it - I can use drop down
menus like this
in all my forms.
Thanks again and I am sure I'll have more questions soon.
Douglas
Douglas Brantz wrote:
> Here is the code I am using.
>
> my $sth = $dbh->Query("select title from project")
> or die $Mysql::db_errstr;
>
> my $numrows = $sth->rows;
> if ($numrows = = 0)
>
> #Now set up an array and a hash:
> my @s_project_values= ();
> my %s_project_labels;
>
> #Loop through all the records found and fill the array and hash:
> my $i;
> for( $i = 0; $i < $numrows; $i++ )
> {
> my @row = $sth->fetchrow_array;
> push( @s_project_values, $row[1]);
> $s_project_labels{$row[1]} = $row[0];
>
> }
>
> # now create the drop down menu
> print $query->scrolling_list({ -name=>'NEWBNAME',-size=>'1',
> -onchange=>'location_change(this)',
> -values=>'\@s_project_values',
> -labels=>'\%s_project_labels'} );
>
> Thanks for all the help in advance - should I be posting this to a Perl
> listserve?
> Am I getting the info correctly from Mysql ?
>
> Thanks,
>
> Douglas Brantz