Shoutbox

Set Cookie wont work - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Set Cookie wont work (/showthread.php?tid=53363)

Set Cookie wont work by Ash_ on 11-27-2005 at 08:33 AM

code:
<?php
$value = 'something from somewhere';

setcookie("TestCookie", $value);
echo $_COOKIE["TestCookie"];
?>



does anyone see any problems, or is there a any bugs that might stop setcookie  working.

i've googled to no avail.

im running EasyPHP 1.8 with Curl and php_mbstring plugins enabled.

any other information needed please post.
RE: Set Cookie wont work by Eljay on 11-27-2005 at 08:59 AM

$_COOKIE['TestCookie'];

not

$_COOKIE["TestCookie"];


RE: Set Cookie wont work by -dt- on 11-27-2005 at 09:09 AM

quote:
Originally posted by Lee Jeffery
$_COOKIE['TestCookie'];

not

$_COOKIE["TestCookie"];
that makes no difference...


ashhhhhhhhh i told you COOKIES DONT APPLY TILL NEXT RELOAD so insert it into the $_COOKIE array yourself like

code:
setCookie('xxx','hawt');
$_COOKIE['xxx'] = 'hawt';



edit:

and if you look on the setCookie function page it says

quote:
Originally posted by http://php.net/setCookie

Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays. Note, autoglobals such as $_COOKIE became available in PHP 4.1.0. $HTTP_COOKIE_VARS has existed since PHP 3. Cookie values also exist in  $_REQUEST.