Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

i have made the necesary changes and i now get no sytax errors when using this script. however all i want to do is take all the selected options from a scrolling box and then store them in the array and just print them to screen but nothings happening can you see why??
#!/usr/local/bin/perl -w use CGI; use DBI; my @teamOption= param ("teamOption"); print "Content-type: text/html\n\n"; print "<html>"; print "<body TEXT='#000000' BGCOLOR='#FFFFFF' LINK='#0000EE' VLINK='#5 +51A8B'ALINK='#FF0000'>\n"; # Print out a table of teams chosen print "<table border=1> \n"; print "<tr> \n"; print "<th> List of teams chosen </th> \n"; print "<tr> \n"; for $team (@teamOption){ # Print row print "<tr> \n"; print "<td> $team </td> \n"; print "</tr> \n"; } print "</table>"; print "</body>"; print "</html>";

Replies are listed 'Best First'.
Re: cgi problem returns
by Masem (Monsignor) on Mar 30, 2001 at 01:05 UTC
    You need to have a CGI object that will initialize and grab the data, before you can use it. Include my $cgi = new CGI; after your use calls, and then use $cgi->param("teamOption") to get the remaining details.
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
Re: cgi problem returns
by arturo (Vicar) on Mar 30, 2001 at 01:51 UTC

    You could, as has already been mentioned, use the OO interface and instantiate a new CGI object, calling the param method, or you could import the CGI module's param function with

    use CGI qw(:param);

    or use the full name of the param function, i.e.

    my @teamOption = CGI::param('teamOption');

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Re: cgi problem returns
by busunsl (Vicar) on Mar 30, 2001 at 01:07 UTC
    You have to create a CGI object to use the params:
    ... use CGI; my $q = CGI->new; my @teamOption = $q->param("teamOption"); ...