Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting multiple cookies with one cgi script? 1

Status
Not open for further replies.

jollekox

Programmer
Feb 3, 2004
23
NO
I have seen web pages setting two or more cookies at a time, how can I accomplish to do this?

Code:
my $cookie = $query->cookie(-name=>'name',
-value=>'value',
-expires=>'+3d',
-domain=>'domain.com');

print $query->header(-cookie=>$cookie);

The code above does not seem to allow this?

Thanks in advance!
Best regards,
Jo Andreas
 
To create multiple cookies, give header() an array reference:

$cookie1 = $query->cookie(-name=>'riddle_name',
-value=>"The Sphynx's Question");
$cookie2 = $query->cookie(-name=>'answers',
-value=>\%answers);
print $query->header(-cookie=>[$cookie1,$cookie2]);


Read the CGI.pm doc for more information on cookies. Everything you probably want to know is in there.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top