First off, this is a mailing list for CGI::Application not just CGI. Second off, put a 'use strict' at the top before your 'use CGI' and it will give you lots of errors. The problem that you are seeing with your cookie has nothing to do with CGI or cookies, but variable scoping and declaration.

Just as another hint, try looking at some templating modules (HTML::Template, or Template Toolkit) so that you don't directly print HTML from you perl code. It's much easier to work with and maintain.

HTH

manoj tr wrote:
Hai all,

 I can get the value of cookie that i registered early in a popup window opened by the 
javascript function winow.open().

I placed the code below. If any one can help me, i am  thankful to u.

Thanks in advance.

CODE
************************************************

#!/usr/bin/perl
use CGI;
$output = new CGI("");
$input = new CGI;
print "Content-type: text/html\r\n\r\n";
if ($input->param('cmd') eq 'test2') {&test2;}
else { &test; }
sub test {
$cookie = $output->cookie(-name => 'uid', -value => '100', -expires => '+1d');
print $output->header(-expires => '-1d',-cookie => $cookie);
print "<html>\n";
print "<head>\n";
print $cookie." ssssssssssssssssssssssf \n";
print "<script language=\"Javascript\">\n";
print "function spawn(page) {";
print "window.open(page,\"\",\"left=5,top=5,height=480,width=600,status=yes,toolbar=no,menubar=no,scrollbars=yes\");} </script>\n";
print "</head>\n";
print "<body lang=en-US style=\"background-color: rgb(153, 204, 255);\"\n";
print " <h3>MENU</h3>\n";
print "<p><a href=\"#\" Onclick='spawn(\"/testcookie.pl?cmd=test2\")\'>Online Test </a></p>";
print "</body></html>\n";
}
sub test2 {
print "<html>\n";
print "<head>\n";
print $cookie." dffffffffffffffffffffff \n";
print "</head>\n";
print "<body lang=en-US style=\"background-color: rgb(153, 204, 255);\"\n";
print " <h3>MENU</h3>\n";
print "<p><a href=\"#\" >Online Test </a></p>";
print "</body></html>\n";
}


****************************************************************************

In the function test2 i cant get the value of cookie.

So plzzzzzzzz help me.......


Regards Manoj

-- Michael Peters Developer Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to