Page 1 of 1

Cookies not setting

Posted: Wed Jun 23, 2004 12:28 pm
by robjime
<?php
$value = 'something from somewhere';

setcookie("TestCookie", $value);
?>
even when I just used the code from php.net my cookies won't set, any ideas

Posted: Wed Jun 23, 2004 12:31 pm
by markl999
bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])

If you don't give it the expire option then the cookie expires at the end of the session (when the browser closes), sure you're not getting this behaviour?

Posted: Wed Jun 23, 2004 12:34 pm
by robjime
nope that didn't work either, even when i left the window open it still didn't go?

http://robjime.vzz.net/cookie.php

Posted: Wed Jun 23, 2004 12:36 pm
by launchcode
Didn't go where? What code are you using to check the cookie exists?

Posted: Wed Jun 23, 2004 12:36 pm
by feyd
you may want to try the following

Code: Select all

setcookie("TestCookie",$value,0,'/');

Posted: Wed Jun 23, 2004 12:37 pm
by markl999
The link above sets a cookie ok for me *shrug*

Posted: Thu Jun 24, 2004 12:00 am
by ol4pr0
hehe. i think that u can try best what Feyd posted up there.. especially the '/' in the fourth place