in reply to Re^2: Generating Select elements with foreach loops
in thread Generating Select elements with foreach loops

Sorry, yes my example wasn't very clear. If -default is set to one of the values, then the correct item in the list is selected. I think you can get the required value from your %userRecord hash.

If I change the code to:

print popup_menu(-name => 'foo', -values => \@quantities, -labels => \%labels, -default => 25);

Then I get the following output:

<select name="foo" > <option value="1">Individual</option> <option value="5">5</option> <option value="10">10</option> <option selected="selected" value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select>
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^4: Generating Select elements with foreach loops
by pickledegg (Novice) on Jul 11, 2006 at 10:50 UTC
    Many thanks dave, you are most definitely

    'the man'