$returnpage = $ENV{HTTP_REFERER}; # Not all Browser send this value, so test to see whether $returnpage is defined. If not, then you may have to assign a value to it like:
$returnpage = "origin.pl"; $cook_admin = $cgi_this->cookie(-name=>'admin', -value=>$value1); $cook_session = $cgi_this->cookie(-name=>'session', -value=>$value2); You don't have to send 2 headers. print $cgi_this->redirect(-uri=>$returnpage, -cookie => [=>[$cook_admin,$cook_session], ); HTH Babs ||> -----Original Message----- ||> From: J. Alejandro Ceballos Z. [mailto:[EMAIL PROTECTED] ||> Sent: Wednesday, May 05, 2004 2:36 AM ||> To: [EMAIL PROTECTED] ||> Subject: A cookie is not stored ||> ||> I am trying to make a cgi that set two cookies and return to the original page. ||> ||> Almost everything works fine, but only the second cookie is stored, not the ||> first one. If I ask for their values before using header, they have the ||> correct values. ||> ||> In the other hand, if you see, I am using a -location inside the header. I ||> don't know if it is correct, or how to redirect to a page if using redirect ||> with header gives me some problems (note commented line). ||> ||> I will appreciate any clue (maybe a little mistake). ||> ||> ||> ------ ||> ||> use CGI; ||> use MIME::Base64; ||> ||> $cgi_this = new CGI; ||> $str_somedata = $cgi_this->param('password'); ||> $value1 = encode_base64("some stuff : $str_somedata"); ||> $value2 = encode_base64("more data"); ||> $returnpage = $ENV{HTTP_REFERER}; ||> ||> $cook_admin = $cgi_this->cookie(-name=>'admin', -value=>$value1); ||> $cook_session = $cgi_this->cookie(-name=>'session', -value=>$value2); ||> ||> # print $cgi_this->redirect(-uri=>$returnpage); ||> # print $cgi_this->header(-cookie =>[$cook_admin,$cook_session]); ||> print $cgi_this->header(-cookie =>[$cook_admin,$cook_session], ||> -location=>$returnpage); ||> ||> -- ||> ||> ||> Saludos, ||> ||> ||> J. Alejandro Ceballos Z. | ||> ---------------------------+--------------------------- ||> http://alejandro.ceballos.info | ||> [EMAIL PROTECTED] | "El pasado siempre termina ||> -------------------------------+ por darnos alcance, ||> Tel: (33) 3647-7809 | por mucho que corramos." ||> Cel: (33) 1076-4705 | ||> | -- El enigma de Cambises, Paul S. ||> ||> ||> ||> -- ||> To unsubscribe, e-mail: [EMAIL PROTECTED] ||> For additional commands, e-mail: [EMAIL PROTECTED] ||> <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>