The following is called from a simple HTML page using
<A href = "thisProgram.pl?PARA1=value1&PARA2=value2"><?A>
Perl stuff
#!/usr/bin/perl
use CGI qw(:standard);
# This perl script calls itself and posts variables back to itself.
# It can find the virtual path to itself & query string from the server environment variables
my $thisURLandQuery = $ENV{'SCRIPT_NAME'};
if (length($ENV{'QUERY_STRING'})>0)
{
$thisURLandQuery =$thisURLandQuery.'?'.$ENV{'QUERY_STRING'} ;
}
# the first call of the script from the HTML succeeds
# passing in PARA1 and PARA2
# it then returns empty $parameter1 and $parameter2 when it calls itself . Anyone know why?
my %data;
foreach my $name ( param() )
{
$data{$name} = param($name);
}
my $parameter1=$data{'PARA1'};
my $parameter2=$data{'PARA2'};
#Later-on it calls itself from a form being submitted
print "<form method='post' action=$thisURLandQuery>";
Replacing the part in Italics with the following suceeds:
my $parameter1=&kensQueryParse($ENV{'QUERY_STRING'},'PARA1=');
my $parameter2=&kensQueryParse($ENV{'QUERY_STRING'},'PARA2=');
# where kensQueryParse(inputVariable, paraNameToFind)
# is a home-made query-string value extractor
<A href = "thisProgram.pl?PARA1=value1&PARA2=value2"><?A>
Perl stuff
#!/usr/bin/perl
use CGI qw(:standard);
# This perl script calls itself and posts variables back to itself.
# It can find the virtual path to itself & query string from the server environment variables
my $thisURLandQuery = $ENV{'SCRIPT_NAME'};
if (length($ENV{'QUERY_STRING'})>0)
{
$thisURLandQuery =$thisURLandQuery.'?'.$ENV{'QUERY_STRING'} ;
}
# the first call of the script from the HTML succeeds
# passing in PARA1 and PARA2
# it then returns empty $parameter1 and $parameter2 when it calls itself . Anyone know why?
my %data;
foreach my $name ( param() )
{
$data{$name} = param($name);
}
my $parameter1=$data{'PARA1'};
my $parameter2=$data{'PARA2'};
#Later-on it calls itself from a form being submitted
print "<form method='post' action=$thisURLandQuery>";
Replacing the part in Italics with the following suceeds:
my $parameter1=&kensQueryParse($ENV{'QUERY_STRING'},'PARA1=');
my $parameter2=&kensQueryParse($ENV{'QUERY_STRING'},'PARA2=');
# where kensQueryParse(inputVariable, paraNameToFind)
# is a home-made query-string value extractor