kjg has asked for the wisdom of the Perl Monks concerning the following question:
I want to pass the value the user selects in this drop down to a variable so that I can use it in Perl to look for a file with a name that correponds to the selected value and if it finds the file, to open it. I'm trying to create the drop down field like this:<option selected value="Select a month">Select a month</option> <option value="0305">March 2005</option> <option value="0405">April 2005</option> <option value="0505">May 2005</option> <option value="0605">June 2005</option> <option value="0705">July 2005</option></select>
I've got the subroutine looking for the filename and opening it working, what I can't get to work is: 1. How to get the selected value out of the Drop Down Menu 2. How to get the Drop Down month to display in month order. (They currently display in this order in the list: June 2005, March 2005, July 2005, May 2005, April 2005 Can anyone help?my %month = ( "March 2005" => "0305", "April 2005" => "0405", "May 2005" => "0505", "June 2005" => "0605", "July 2005" => "0705", ); print option_list(\%month); sub option_list { my $options = shift; return "<select>\n" . (join '', map{ qq!<option value="$options->{$_}">$_</option>\n! } keys %$options ) . "</select>\n"; }
20050317 Edit by castaway: Changed title from 'Extracting selelcted values from HTML Select Menus'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting selected values from HTML Select Menus
by jhourcle (Prior) on Mar 14, 2005 at 12:31 UTC | |
|
Re: Extracting selected values from HTML Select Menus
by bradcathey (Prior) on Mar 14, 2005 at 12:09 UTC | |
by kjg (Sexton) on Mar 14, 2005 at 12:14 UTC | |
by bradcathey (Prior) on Mar 14, 2005 at 20:19 UTC | |
|
Re: Extracting selected values from HTML Select Menus
by punkish (Priest) on Mar 14, 2005 at 15:11 UTC | |
by kjg (Sexton) on Mar 15, 2005 at 10:47 UTC | |
by kjg (Sexton) on Mar 15, 2005 at 11:15 UTC | |
by kjg (Sexton) on Mar 15, 2005 at 11:33 UTC |