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;

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to