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


In reply to Re: Attribute values are not passed into the variable using perl cgi? by NetWallah
in thread Attribute values are not passed into the variable using perl cgi? by gpssana

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.