CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
The Get method does not shows the submit value in url

 



sh.ajay12
User

Jun 10, 2014, 2:09 AM

Post #1 of 5 (5297 views)
The Get method does not shows the submit value in url Can't Post

Hello Members,

I am using a first.cgi script to pass two values to second.cgi script with GET method, but the values are not visible in the url.

Please let me know, how to resolve this error. Please tell me some easy solution.

Here is first.cgi http://opbay05nagios/cgi-bin/first.cgi?shortname=PEPSIO url

our @LISTOFGRAPHS=`ls /usr/local/nagios/$SHORTNAME/etc/pnp4nagios/pages/*.cfg`;


printf("<p>Select The File Name For The Report</p>\n");

printf("<FORM METHOD=GET ACTION=second.cgi>\n");
printf("<select name=file>\n");
printf("<option value= >Select Options</option>\n");

foreach my $link (@LISTOFGRAPHS)
{
my ($k, $v) = split(/\./, $link, 2);

our $result=`grep page_name $link`;
my ($a, $b) = split(/ /, $result, 2);
(our $wanted)= $link =~ /pages\/(.*)\.cfg/g;

printf("<option value= >$b</option>\n");
}
printf("</select>\n");
printf("<select name=time>\n");
printf("<option value= >Select Options</option>\n");
printf("<option value= >Daily</option>\n");
printf("<option value= >Last 7 Days</option>\n");
printf("<option value= >Weekly</option>\n");
printf("<option value= >Monthly</option>\n");
printf("<option value= >Yearly</option>\n");
printf("</select>\n");
printf("<input type=submit value=Submit>\n");
printf("</FORM>\n");
print "</body></html>\n";

Here is the second.cgi script which process the values of GET method http://opbay05nagios/cgi-bin/second.cgi

#!/usr/bin/perl
use strict;
use warnings;

use warnings FATAL => qw(uninitialized);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser carpout);
use CGI ':standard';

print "Content-type:text/html\n\n";

use CGI qw/:param/;
our $filename = param('file');
our $time = param('time');
print header,
start_html(-title=>$filename),
h1("Welcome $filename"),
h1("Welcome $time"),
end_html;


Thanks In Advance.


(This post was edited by sh.ajay12 on Jun 10, 2014, 2:12 AM)


sh.ajay12
User

Jun 10, 2014, 2:18 AM

Post #2 of 5 (5286 views)
Re: [sh.ajay12] The Get method does not shows the submit value in url [In reply to] Can't Post

Please let me understand this

I have noticed a very strange thing.

when in first.cgi

i use this code.

printf("<INPUT TYPE=submit VALUE=Submit>\n");
#printf("<input type=submit value=Submit>\n");

then the after clicking the submit button the url for second.cgi is like this.

http://opbay05nagios/cgi-bin/second.cgi?file=&time=

but if i use this code in first.cgi

printf("<input type=submit value=Submit>\n");

then the url after clicking the submit button for second.cgi is like this.

http://opbay05nagios/cgi-bin/second.cgi


sh.ajay12
User

Jun 10, 2014, 3:01 AM

Post #3 of 5 (5253 views)
Re: [sh.ajay12] The Get method does not shows the submit value in url [In reply to] Can't Post

Please any one can help me out.

i am always getting this url after clicking the Submit button.

http://opbay05nagios/cgi-bin/second.cgi?file=&time=

what is the reason ??


sh.ajay12
User

Jun 10, 2014, 3:16 AM

Post #4 of 5 (5242 views)
Re: [sh.ajay12] The Get method does not shows the submit value in url [In reply to] Can't Post

any way, i found out the solution. now it is passing the values in url.

Thank you guys.


Laurent_R
Veteran / Moderator

Jun 10, 2014, 1:32 PM

Post #5 of 5 (5186 views)
Re: [sh.ajay12] The Get method does not shows the submit value in url [In reply to] Can't Post

I wish I could have helped you (although CGI scripting is really not my best area of knowledge), but I don't spend my life time on this site and only connect here a few times per day. Judging from the time stamps of your various posts, I have the vague feeling that you did not investigate too deeply before posting your OP.

I am active on at least four different Perl forums, and I am trying to give help far far far more often than I ask for help, but when I do ask for help, I do it only after having really tried hard to solve the issue. It may still happen someday that I ask for help and find the solution within an hour or two, but this is very unlikely (and I don't think it ever happened so far). Well, I realize that it may seem that I am trying to give you a lesson, this is really not my mindset. I am just trying to tell you and others that it is often better to try hard to solve the issue, because if you find the solution yourself, you will probably remember it for your lifetime. If someone gives it to you, you are much more likely not to remember it next time you face the same or a similar issue.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives