Re: Passing user data between scripts
- From: xhoster@xxxxxxxxx
- Date: 27 Mar 2006 23:40:45 GMT
game4itguy@xxxxxxxxx wrote:
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'});
You should almost certainly use CGI. Even more especially so as you are
already using CGI::Carp!
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>};
Using CGI's functions, something like this (untested):
print q{<a href="2.pl?} . query_string() . q{">Click here for 2.pl</a>};
Althrough I rarely do this. If I want two different scripts to receive
pretty much the same data, I'd usually combine them into one script which
just took another paramter telling it whether you wanted mode1 behavior or
mode2 behavior.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- Follow-Ups:
- Re: Passing user data between scripts
- From: game4itguy
- Re: Passing user data between scripts
- References:
- Passing user data between scripts
- From: game4itguy
- Passing user data between scripts
- Prev by Date: Re: XML::Simple and utf8 woes
- Next by Date: Why is my substitution doubling up on brackets?
- Previous by thread: Re: Passing user data between scripts
- Next by thread: Re: Passing user data between scripts
- Index(es):
Relevant Pages
|