My Name is Srinivas,
I am devloping a CGI application using Perl. I am using CGI::Session
module,here i am facing a problem, i am not able to retrieve the session
values from one page to anther page.Could u please help me out.My program is
below
First Page
use CGI::Session;
use CGI qw/:standard/;
$session = new CGI::Session();
my $CGISESSID = $session->id();
print header();
print start_html();
print '<form id="MainForm" method="Post" width="200px" >';
$session->param('f_name', 'Sherzod');
$session->param(-name=>'l_name', -value=>'Ruzmetov');
my $f_name = $session->param('f_name');
my $l_name = $session->param(-name=>'l_name');
print '<input type=button value=FWD onclick="Action()">';
print '<script language="Javascript">';
print 'function Action()
{
document.forms(0).action="s.pl?'.$session->name.'='.$CGISESSID.'"; //
Here the Session values are getting stored as querystring
document.forms(0).submit();
}' ;
print '</script>';
print end_html();
Second Page S.pl
use CGI qw(:standard);
use CGI::Session;
print header;
print start-html();
my $name;
my $value;
if (length ($ENV{'QUERY_STRING'}) > 0){
my $buffer = $ENV{'QUERY_STRING'};
my @pairs = split(/&/, $buffer);
($name, $value) = split(/=/, $pairs[0]);
}
my $session = new CGI::Session( $value);
print $session->name;
print $session->id;
print $session->param('f_name');
print end-html();
Regards
Srinivasa Rao S
|