hi monks

I am trying to submit the CGI form with multiple buttons along with submit button. My intention is to select one of the preset and press SUBMIT button. This isn't working as preset button value is not passed or didn't get submit when I actually press the SUBMIT button. I am getting values for rest of the form fields (not included in the script). Can somebody help me? Thank you.

use strict; use CGI; my $q = new CGI(); print $q->header(); print $q->start_html(-title => 'Test HTML'); my $namescript = 'http://' . $ENV{'SERVER_NAME'} . (($ENV{'SERVER_PORT +'} != 80) ? ":$ENV{'SERVER_PORT'}" : "") . $ENV{'SCRIPT_NAME'}; print $q->startform("POST", $namescript); my %presets = ( 'preset_appleid' => 'APPLEID', 'preset_default' =>'DEFAULT', 'preset_ntlm' =>'NLTM', 'preset_security' => 'SECURITYQ', 'preset_web16' => 'Web Site (16 Chars)', 'preset_web32' => 'Web Site (32 Chars)', 'preset_wifi' => 'WIFI', 'preset_xkcd' => 'XKCD', ); foreach my $preset ( keys %presets ) { print $q->button( -name => $preset, -id => $preset, -value => $presets{$preset}, ); } print $q->submit(-value => 'SUBMIT'); print $q->endform; print $q->end_html();

In reply to How to handle multiple buttons inside CGI form by doubledecker

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.