doubledecker has asked for the wisdom of the Perl Monks concerning the following question:
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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to handle multiple buttons inside CGI form
by graff (Chancellor) on Feb 03, 2015 at 05:41 UTC | |
by doubledecker (Scribe) on Feb 03, 2015 at 05:53 UTC | |
by GrandFather (Saint) on Feb 03, 2015 at 06:38 UTC | |
by silent11 (Vicar) on Feb 03, 2015 at 15:35 UTC |