Dear List,

I try to bind a hash containing the result of a query to a popup button.
If I make the hash 'manually' it is not using the result of my selection than
everything works fine.
If I populate the hash from the selection than it will not display. So I presume
that my hash creation contains an error.
Can anybody explain me the 'trick' to populate a hash from a database selection?

I am using Perl 5.6.1 on Linux 8.1 and Apache the database is Oracle 8.1.6.
Please find the piece of code hereunder, I would be most obliged.

$sth4 = $dbh->prepare ( qq {$sqlcon});
 $rc4 = $sth4->execute
           or carp "dbh->errstr Can not select data for listbox $\n";
 $listcounter = 0;
 $hashstring = "";
 $value = 4;
  while ((@row4) = $sth4->fetchrow_array) {
         push @ids, "@row4[0]";
         if ($listcounter == 0) {
            $hashstring .= "@row4[0],'" . "@row4[1]'";
         }
         else {
            $hashstring .= ",@row4[0],'" . "@row4[1]'";
         };
         $listcounter = $listcounter + 1;
       };
       %somelabels = ($hashstring);
       ## %somelabels = (2,'Spot',3,'Eurimage',4,'Test 4');    ## this works, it
is the labels are shown
       print $query->popup_menu ($columnname
                                    ,\@ids
                                    ,"$value"
                                    ,\%somelabels);
        ## the result shows as labels only the content of list "ids"
       splice @ids, 0;
       $listbox = 0;
     };
};

Regards Alfred de Jager

Reply via email to