note 96251 modified in function.setcookie by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Feb 2010 14:50:24 +0000 |
| Subject: | note 96251 modified in function.setcookie by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166063@lists.php.net to get a copy of this message | ||
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');
?>
--was--
When setting a cookie on a page that redirects, the cookie must be set after the call to
header('Location: ....');
Such as:
header('Location: http://www.site.com/');
setcookie('asite', $site, time()+60*60, '/', 'site.com');
http://php.net/manual/en/function.setcookie.php