Oh I see, you want us to write your code for you, without showing any effort on your part.....
For reasons which escape me...
#!/usr/bin/perl
use warnings;
use strict;
use CGI;
my $q = CGI->new;
print $q->header, $q->start_html(-title=>"Monkies");
my @options = qw/Macaque Proboscis Invisible Lemur/;
if($q->param("monkies")) {
print "It looks like you selected the following symian friends
+.<br />\n";
print join("<br />\n", $q->param("monkies"));
}
print $q->start_form;
print $q->popup_menu(-name=>"monkies", -values=>\@options, -multiple=>
+"multiple", -size=>"5");
print $q->submit(-value=>"Choose");
print $q->end_form;
print $q->end_html;
If there's anything there that you don't understand, I recommend checking
Ovid's
CGI course, and of course the manual for the lovely
CGI module.
Side note, you'd be better off using one of the
templating modules rather than CGI's methods for generating HTML, but that's just an opinion
davis
It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
Re: multi select box
by Abigail-II (Bishop) on May 24, 2004 at 14:00 UTC
|
Oh I see, you want us to write your code for you, without showing any effort on your part.....
For reasons which escape me...
Must be because there's always a sucker who does....
Abigail
| [reply] |
|
|
Must be because there's always a sucker who does....
Perhaps... but I was feeling charitable, and there's the slimmest of chances that providing examples with admonishment might lead the OP to learn something. After all, the code I provided is useless to anyone without modification.
davis
It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
| [reply] |
|
|
You guys crack me up. The fact is I have done work and searched a good bit for the answer but I suppose I was looking in the wrong place. Although I don't expect people to write code for me I do think it is very helpful if someone who wants to share their knowledge without all the "make you feel guilty" attitude just posts some code that they have already written. Remember, everyone was new at Perl at some point. If you did all the research yourself and never used anyone else's code then codos to you but my guess is that most everyone has used other people's code at some point.
Anyway, to the one that greatly helped me with posting some code, thank you very very much!!!!!
| [reply] |
|
|
I won't deny that RTFM'ing can be hard, especially with a documentation base as huge as CGI.pm's. The relevent section in the docs is right here, by the way. I found it by searching for the token 'param()' and yes, the parens are very necessary. :)
Good luck to you, and why not just sign in and attach a user name to your presence? We can
only bark, we can't bite. ;)
| [reply] |