On Sat, 16 Oct 2004, Charles K. Clarkson wrote:
> Date: Sat, 16 Oct 2004 07:51:36 -0500 > From: Charles K. Clarkson <[EMAIL PROTECTED]> > To: 'Charlotte Hee' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: RE: scrolling_list and multiples > > Charlotte Hee <[EMAIL PROTECTED]> wrote: > > : Here's the code: > : > : #!/usr/local/bin/perl -w > : > : use strict; > : use CGI qw(:standard :html3); > > That's redundant. > > print join ', ', @{ $CGI::EXPORT_TAGS{':standard'} }; > > > : our(@catArray, $val, $url); > > Don't use 'our' this way. Use 'my' to declare your > script variables. > > > : @catArray = ("Time Magazine","MIT Technology","Herbalist"); > : > : print header, > : start_html('Subscribe'), > : h3('Subscriptions'); > > Use white space more effectively. Avoid using double > quotes. > > my @catArray = ( > 'Time Magazine', > 'MIT Technology', > 'Herbalist' > ); > > print > header(), > start_html('Subscribe'), > h3('Subscriptions'); > > > : if ( param() ){ # the form has been submitted > : foreach ( param() ){ > : $val = param($_); > : print h4("$_ = $val"); > : } > > As Gunnar mentioned, $val only grabs the first value > off param( 'choice' ). Also, $val is not used outside > this code block. It does not need to be in the 'our' > declaration you are using. > > my @val = param($_); > print h4( "$_ = @val" ); > > > > : }else { # first time form is displayed > : print start_form(-method=>"POST", -action=>"$url/pbauto"); > > $url hasn't been defined. This will probably do what you > want. > > print start_form(); > > > > : print h3("Enter Your Name"),p; > : print textfield(-name=>"Name", -size=>20),p; > : print h3("Choose Your Subscriptions"),p; > : print scrolling_list("choice",[EMAIL PROTECTED], > : undef,6,multiple=>1), p; > : print submit(-name=>"submit",-value=>"submit"); > : print reset(-name=>"reset",-value=>"reset"); } > > reset() doesn't take arguments. > > You didn't end the form. > > } else { > > print > start_form(), > > h3( 'Enter Your Name'), > textfield( > -name => 'Name', > -size => 20 ), > > h3('Choose Your Subscriptions'), > scrolling_list( > 'choice', > [EMAIL PROTECTED], > undef, > 6, > 1, ), > br(), br(), > > submit( > -name => 'submit', > -value => 'submit' ), > reset(), > > end_form(); > } > > : print end_html; > I tried replacing 'use CGI qw( :standard :html )' with print join ', ', @{ $CGI::EXPORT_TAGS{':standard'} }; but that just gave me the error "Can't use an undefined value as an ARRAY reference at SUslac01test line 15." I'm not sure how I'm suppose to use this. Otherwise all your advice was very helpful/useful. thanks, Chee -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>