Re: [Cgi-session-user] Cgi-session-user Digest, Vol 2, Issue 7
Brought to you by:
sherzodr
From: Srinivasa R. <sri...@gm...> - 2006-06-21 04:49:16
|
Hi Ron Savage, Thanks For Replaying, in the second page i am getting the Session id and i am passing that session id to the CGI::Session as a parameter , but it is creating new session and i am not able to get the values what i stored in the first page.I am able to print the seesion id in the next page but i am not able maintain the session.Please help me .If u have any doubts please feel free to contact me. Regards Srinivasa Rao S On 6/21/06, cgi...@li... < cgi...@li...> wrote: > > Send Cgi-session-user mailing list submissions to > cgi...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > or, via email, send a message with subject or body 'help' to > cgi...@li... > > You can reach the person managing the list at > cgi...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Cgi-session-user digest..." > > > Today's Topics: > > 1. Hi Sir (Srinivasa Rao) > 2. Re: Hi Sir (Ron Savage) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 20 Jun 2006 09:56:45 +0530 > From: "Srinivasa Rao" <sri...@gm...> > Subject: [Cgi-session-user] Hi Sir > To: "cgi...@li..." > <cgi...@li...> > Message-ID: > <ad9...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > 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 > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://sourceforge.net/mailarchive/forum.php?forum=cgi-session-user/attachments/20060620/d328597e/attachment.html > > ------------------------------ > > Message: 2 > Date: Tue, 20 Jun 2006 15:58:32 +1000 > From: Ron Savage <ro...@sa...> > Subject: Re: [Cgi-session-user] Hi Sir > To: List - CGI-Session <cgi...@li...> > Message-ID: <2006620155832.491237@MONASH-7ADADE6D> > Content-Type: text/plain; charset=ISO-8859-1 > > On Tue, 20 Jun 2006 09:56:45 +0530, Srinivasa Rao wrote: > > Hi > > > use CGI::Session; > > use CGI qw/:standard/; > > $session = new CGI::Session(); > > $session = CGI::Session -> new(). > > This is a good habit to get in to, and the difference matters when you > start > using inheritance. > > > 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 > > No they are not. You're using single quotes in the print statement, so > $CGISESSID is not interpolated. > > > document.forms(0).submit(); > > }' ; > > Instead, use qq. E.g.: > > print qq|function ......|; > > > print '</script>'; > > print end_html(); > > Please send all replies to the list. > -- > Ron Savage > ro...@sa... > http://savage.net.au/index.html > > > > > > ------------------------------ > > > > ------------------------------ > > _______________________________________________ > Cgi-session-user mailing list > Cgi...@li... > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > > > End of Cgi-session-user Digest, Vol 2, Issue 7 > ********************************************** > |