Anyone for cookies and milk? :-)

From: Date: Wed, 16 Jul 2003 21:19:26 +0000
Subject: Anyone for cookies and milk? :-)
Groups: php.general 
Request: Send a blank email to php-general+get-155490@lists.php.net to get a copy of this message
Hey, Am just getting into PHP cookies and have gotten a problem...(surprise surprise) Am trying to set a basic cookie to see exactly how things work before I start using it in my apps, heres the code i am using: (SetCookieEx.php) <?php setcookie("name1","1","","",".bestwebhosters.com"); setcookie("name2","1","","",".bestwebhosters.com"); echo "done"; ?> This is the output I am getting: ********************** Warning: setcookie() expects parameter 3 to be long, string given in /bestweb/public_html/testing/SetCookieEx.php on line 2 Warning: setcookie() expects parameter 3 to be long, string given in /bestweb/public_html/testing/SetCookieEx.php on line 3 done This is how I am trying to read the cookies: (ReadCookieEx.php) **************************** <?php if (isset($_COOKIE ['name1'])){ echo $_COOKIE ['name1']; }else{echo "wrong1";} if (isset($_COOKIE ['name2'])){ echo $_COOKIE ['name2']; }else{echo "wrong2";} ?> This is the output i am getting: ******************* wrong1wrong2 Anybody have any ideas? Cheers, -Ryan

« previous php.general (#155490) next »