Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How to call sub routine onclicking submit button by different site selection from the popup menu using perl cgi script ?

by perlanswers (Initiate)
on Apr 04, 2017 at 06:36 UTC ( #1186941=perlquestion: print w/replies, xml ) Need Help??

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

print start_form(-method=>'GET'); print " <br> &nbsp<B>Site</B> &nbsp"; $site_selected="place"; print popup_menu( -name => 'popup1', -values =>['place','place1','place2','place3'], -default => 'value2' -submit => 'submit' ); print "&nbsp &nbsp &nbsp &nbsp &nbsp "; print submit(-name=>'submit',-values=>'submit'); print end_form;

I had added my part of script in which here the script performs different site selection when submit button is clicked.
If i select the place site from the popup menu the place should read all the sub routines in the script and load the contents from the those subroutine
likewise the same process should happen for all other site selection also.
Now the problem is if i select site place1 the subroutines are not loading its contents for place1 it loads the previous (i.e place) contents.
By my analyses i found that the submit button is not loading its contents for different site selection
How can i load the subroutine contents different site selection onclicking submit button
  • Comment on How to call sub routine onclicking submit button by different site selection from the popup menu using perl cgi script ?
  • Download Code

Replies are listed 'Best First'.
Re: How to ... using perl cgi script ?
by hippo (Chancellor) on Apr 04, 2017 at 08:05 UTC
Re: How to call sub routine onclicking submit button by different site selection from the popup menu using perl cgi script ?
by poj (Abbot) on Apr 04, 2017 at 07:13 UTC

    Where in your code are you fetching the popup1 parameter ?

      I had coded ad like below
      use CGI qw/:all/; use CGI ':cgi-lib'; use CGI::Carp qw(fatalsToBrowser); use DBI; ### Global Variables $GLOBAL{'CURRENT_PAGE'} = self_url; $GLOBAL{'HOME'} = $GLOBAL{'CURRENT_PAGE'}; $GLOBAL{'HOME'} =~s/\?.*//; my %GLOBAL =(); $GLOBAL{'CONTACT_SUPPORT'} = 'filldata@gmail.com'; $GLOBAL{'CURRENT_PAGE'} = self_url; $GLOBAL{'HOME'} = $GLOBAL{'CURRENT_PAGE'}; $GLOBAL{'HOME'} =~s/\?.*//; print start_form(-method=>'GET'); print " <br> &nbsp<B>Site</B> &nbsp"; $site_selected="place"; print popup_menu( -name => 'popup1', -values =>['place','place1','place2','place3'], -default => 'value2' -submit => 'submit' ); print "&nbsp &nbsp &nbsp &nbsp &nbsp "; print submit(-name=>'submit',-values=>'submit'); print end_form; $site_selected = $CGI_PARAM{'popup1'}; if($site_selected =~ /^\s*$/) { $site_selected="place"; }

        just where do you expect $CGI_PARAM to come from? See this Re: submit button fails to pass the values using perl cgi?, i already showed you the answer. Pay particular attention to the my $ispopup1=param('popup1'); line.

        and do you realize that after you say my %GLOBAL =(); all the stuff before it

        $GLOBAL{'CURRENT_PAGE'} = self_url; $GLOBAL{'HOME'} = $GLOBAL{'CURRENT_PAGE'}; $GLOBAL{'HOME'} =~s/\?.*//;
        gets thrown away?

        You will avoid a lot of problems if you start your programs with

        use strict; use warnings;

        And why do you persist in using two names when it is clear that both are the same clueless person?

          A reply falls below the community's threshold of quality. You may see it by logging in.
Re: How to call sub routine onclicking submit button by different site selection from the popup menu using perl cgi script ?
by Anonymous Monk on Apr 04, 2017 at 07:07 UTC

    By my analyses i found that the submit button is not loading its contents for different site selection. How can i load the subroutine contents different site selection onclicking submit button

    use some javascript , perl cant help you there

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1186941]
Approved by NetWallah
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2021-01-23 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?