Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
----------
In the below script i tried to pass the values in the submit button using perl cgi.But it fails in my case.Thanks in advance for any help.

Things which i verified :

In the browser i found the submit button fails to load the value which i had passed.Instead it shows the value as submit.

http://ad.sd.anog.com/cas/dev/rard/1an/bin/rsdb.cgi?popup1=landlord&submit=submit

For your reference:

my %site = (
Place1 => [ qw(place1) ],
Place2 => [ qw(place2) ],
Place3 => [ qw(place3) ],
Place4 => [ qw(place4) ],
);

Expected thing in the browser:

http://ad.sd.anog.com/cas/dev/rard/1an/bin/rsdb.cgi?popup1=landlord&submit=place2

What I have tried:

Code which i had tried:

    #!/usr/local/bin/perl -wT
    use CGI qw/:standard/;
    use strict;
    use CGI;
    my $action;
    print start_form(-method=>'GET',-action=>$action);
    print " <br>  Site  ";
    print popup_menu(
           -name    => 'popup1',
           -method => 'GET',
            -values=>[sort keys %site],
             );
    print "           ";
    
    print submit(-name=>'submit',-values=>"place2");
    print end_form;
    
    if(submit eq 'submit')
    {
    $action="rsdb.cgi";
    }
Posted
Updated 4-Apr-17 23:52pm

1 solution

Submitted values can not be read until the form is submitted and you are checking for the value 'submit' but pass 'place2' so that the if condition is never true and $action will be empty.

Use param() instead to check the value of submit buttons:
PERL
if (param('submit') eq 'place2')
{
    $action="rsdb.cgi";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900