Mar 10, 2015, 3:42 PM
This will be a very basic question about using Perl's CGI module.
Passing more than one variable in Perl CGI module
I have a cgi script. At the top of the script, a CGI object is created as follows:
my $query_obj = CGI->new;
When the script is called initially there are no params saved. At the beginning of the script, there is a redirect call as follows:
print $query_obj->redirect($query_obj->url."?<var I want to save>=<value for that var>");
When this code is hit, the URL is called again, only with ?<var I want to save>=<value for that var> tacked on to the URL. Now, <var I want to save> is a parameter that can be accessed via: $query_obj->param("<var I want to save>");
Further down in the script, there is a dropdown menu, as follows:
$query_obj->popup_menu(-name=>'a name', -values=>\@values_in_dropdown_menu);
When the code $query_obj->submit is hit, the CGI script is called once again, passing down the value the user selected. The problem now is, I've lost access to my <var I want to save>! How can I pass this var as well during the submit call so I can still have access to it when the page is refreshed?
(This post was edited by perlFun on Mar 10, 2015, 3:43 PM)