in reply to Extracting selected values from HTML Select Menus
1. How to get the selected value out of the Drop Down Menu
You have to give the select a name, so that the browser will send it. In your CGI backend, you then check what value has been sent with that name. So, you need to change the line
"<select>\n" .to something like:
"<select name='date'>\n".See the forms section of the HTML specifications for how to send it, and the CGI or CGI::Lite modules on how to receive it.
2. How to get the Drop Down month to display in month order.
You just need to tell the program what order to print the values -- keys will return in what seems to be a random order (it isn't, but it's not an order that's useful for this). You'll want to change the lines:
(join '', map{ qq!<option value="$options->{$_}">$_</option>\n! } keys %$options ) .
to something like:
(join '', map{ qq!<option value="$options->{$_}">$_</option>\n! } sort sort_function keys %$options ) .
and add a function sort_function that can correctly order your values. See sort for information about writing such a function.
|
|---|