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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Attribute values are not passed into the variable using perl cgi?
by NetWallah (Canon) on Apr 11, 2017 at 05:03 UTC
    Your code does not compile, and your question is unclear.

    I have attempted to correct it - and this code should get you the expected "submit=a1" in the querystring on hitting "submit".

    Also - naming your sub "header" in a CGI program is a bad idea. I changed it to MyHeader.

    uuse strict; use warnings; use DBI; use Getopt::Long; use CGI qw/:all :cgi-lib/; my $CGI_params = Vars(); my %CGI_PARAM = %$CGI_params; my $site = ""; my $site_selected="a1"; $site = "a1"; $site_selected = $CGI_PARAM{'popup'}; $site = $CGI_PARAM{'popup'}; if($site_selected =~ /^\s*$/) { $site = "a1"; $site_selected="a1"; } defined $site or die "usage:$0"; my %map=(a1=>[qw(r_a1_c)],a1=>[qw(r_a2_c)],); show(); sub show{ status(); MyHeader(); } sub status{ my $stm=$site_selected; } sub MyHeader { print start_form(-method=>"GET",-action=>"db.cgi"); print " <br> &nbsp<B>Site</B> &nbsp"; print popup_menu( -name => 'popup', -value => keys % map, -default => 'value2' ); print "&nbsp &nbsp &nbsp &nbsp &nbsp"; print submit(-type=>"submit",-name=>"submit",-value=>$site); print end_form, "\n"; }

            ...it is unhealthy to remain near things that are in the process of blowing up.     man page for WARP, by Larry Wall

        Interesting psychological condition discussed in those links.

        Thank you for the education on a new kind of troll.

                ...it is unhealthy to remain near things that are in the process of blowing up.     man page for WARP, by Larry Wall

        ... this is his 4th userid ... he has had this all pointed out to him before ... Interesting nick name The total number of class rooms in GPS.SANA COMPOUND is 1.

        Suddenly many things become clear. It is not he but they who are registering all these user names and asking the same questions over and over again.

        As is often the case, answers engender more questions. Despite being in a very small school (from the link: thirty-nine students, two teachers, one classroom, four blackboards, no computers — which I take to mean that each student has his or her own laptop), they seem not to share info among themselves. Is this an indication of dedication to individual effort or of unwillingness to cooperate with and support their fellow students?


        Give a man a fish:  <%-{-{-{-<

      the thing is -value=>$site should pass all 'popup'values.

        Add this line to top of your script and then fix the errrors

        use CGI::Carp 'fatalsToBrowser';


        the thing is -value=>$site should pass all 'popup'values.

        The thing should make sense, test, check, its basic debugging

Re: Attribute values are not passed into the variable using perl cgi?
by huck (Prior) on Apr 11, 2017 at 04:53 UTC