note 96251 deleted from function.setcookie by googleguy
| From: | googleguy@php.net | Date: | Tue, 15 Jan 2013 05:12:15 +0000 |
| Subject: | note 96251 deleted from function.setcookie by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193069@lists.php.net to get a copy of this message | ||
Note Submitter: Hjalmar W
----
When setting a cookie on a page that redirects, the cookie must be set after the call to
header('Location: ....');
Such as:
<?php
header('Location: http://www.example.com/');
setcookie('asite', $site, time()+60*60, '/', 'site.com');
?>