in reply to multiple-choice selects

Eric already answered your question with an excellent description of using the CGI 'param' method and accepting the values returned into an array.

I just wanted to point out something I noticed when looking at your code - I think it's incorrect to do
close<FILE>;
So I looked up the 'close' command in the "Programming Perl" book by Wall, Christiansen, and Schwartz - it saws to use close like this:
close FILE;
You can also find perldocs on the 'close' function by doing
perldoc -f close
at a command prompt. I'm not at all sure what 'close<FILE>' really does.

HTH.

Replies are listed 'Best First'.
Re: Re: multiple-choice selects
by Grygonos (Chaplain) on Oct 23, 2003 at 17:03 UTC

    also use strict and warnings.. part of your code would break under strict... no serious problems.. but in future larger projects it could make a world of difference.

    I started perl doing CGI, and to look back on my horrible code from my early CGI days now would make me sick. Also something to try coding style wise is use of $_ in foreach loops, it saves a little memory and is kinda slick.

    one of your loops could be re-written as...
    foreach(@val) { chomp; print "<option value=".$_.">".$_."\n"; }

    Make no mistake... none of this will improve/change the funcionality, but I know from personal experience that when working with CGI and new to perl that people are often more concerned with the ends than the means...so this is just some food for thought.