G
game4itguy
Hi,
I'm positive this is very basic stuff, but I can't seem to find the
information I need, so if anyone could help I'd appreciate it. This is
what I'm trying to do as clearly as I can describe it...
1. I want a user to input data using the GET method.
2. I want 1.pl to display that data on a webpage.
3. I want a link at the bottom of 1.pl to 2.pl.
4. When the user clicks on the 2.pl link, I want 2.pl to display
exactly the same data as 1.pl.
This probably sounds pretty pointless, but I just want to have an
understanding of how it's done so I can use the concept in later
scripts.
I don't actually have a script written yet, but if one's required to
elicit a response, it would look something like the following off the
top of my head...
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
my @userinfo = split(/&/, $ENV{'QUERY_STRING'});
my $data1 = $userinfo[0];
my $data2 = $userinfo[1];
print "Content-type: text/plain", "\n\n";
print "Welcome. $data1, $data2.<p>";
print q{<a href="2.pl">Click here for 2.pl</a>};
exit;
And if anyone feels the desire to also demonstrate how to do this with
the POST method instead of GET, I'd appreciate it!
Many thanks.
I'm positive this is very basic stuff, but I can't seem to find the
information I need, so if anyone could help I'd appreciate it. This is
what I'm trying to do as clearly as I can describe it...
1. I want a user to input data using the GET method.
2. I want 1.pl to display that data on a webpage.
3. I want a link at the bottom of 1.pl to 2.pl.
4. When the user clicks on the 2.pl link, I want 2.pl to display
exactly the same data as 1.pl.
This probably sounds pretty pointless, but I just want to have an
understanding of how it's done so I can use the concept in later
scripts.
I don't actually have a script written yet, but if one's required to
elicit a response, it would look something like the following off the
top of my head...
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
my @userinfo = split(/&/, $ENV{'QUERY_STRING'});
my $data1 = $userinfo[0];
my $data2 = $userinfo[1];
print "Content-type: text/plain", "\n\n";
print "Welcome. $data1, $data2.<p>";
print q{<a href="2.pl">Click here for 2.pl</a>};
exit;
And if anyone feels the desire to also demonstrate how to do this with
the POST method instead of GET, I'd appreciate it!
Many thanks.