$select = $db->prepare( "SELECT username FROM users" ); $select->execute; my @userlist = $select->fetchrow_array; print start_form( action=>'/cgi-bin/index.pl' ); print h1( {class=>'lime'}, "Επέλεξ& +#949; το κείμενο π& +#959;υ σε ενδιαφέ&# +961;ει => ", popup_menu( -name=>'select', -values=> +\@userlist ), submit('Εμφάν +ιση')); print end_form;
In the above code insteaf od the array filling by all usernmes selected from the dataabse it only populates the 1st one.

I want all users to be listed on the pop up menu.

and also this similar question:
my @titlelist; open FILE, "<$ENV{'DOCUMENT_ROOT'}/data/vault/titlelist.txt" or die $! +; @titlelist = <FILE>; close FILE; print br() x 3; print start_form( action=>'/cgi-bin/admin.pl' ); print table( {class=>'user_form'}, Tr( td( '&#928;&#941;&#962; &#956;&#959;&#965; &#964;&#953; &#95 +2;&#945; &#942;&#952;&#949;&#955;&#949;&#962;:' ), + td( popup_menu( -name=>'title' -values=>\@titlelist ))),
Although @titlelist is filled with all entried from titlelist.txt file(one entry per line), when it gets printed with popup_menu it displasy nothing!!

In reply to Populating an array from a mysql select by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.