note 30474 added to function.setcookie

From: Date: Wed, 19 Mar 2003 07:28:32 +0000
Subject: note 30474 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-45509@lists.php.net to get a copy of this message
** Modifying from the former poster ** The script that help to solve the problem of calling cookie for the first time, which return nothing (strlen($cookie)=0). <?php // This script named testcookie.php $cc = strlen($mycookie); if($cc==0){ setcookie("mycookie", "mycookie", time()+3600); //3600 is an hour, in seconds Header("Location: testcookie.php"); // testcookie.php is the document itself exit(); } else { if (!isset($mycookie)) { echo "Your browser does not support cookie"; } else { echo "Your browser does support cookie"; } } ?> hope this script could help you :-) -- http://www.php.net/manual/en/function.setcookie.php http://master.php.net/manage/user-notes.php?action=edit+30474 http://master.php.net/manage/user-notes.php?action=delete+30474 http://master.php.net/manage/user-notes.php?action=reject+30474

« previous php.notes (#45509) next »