Most I find are either too complicated, can't get then to work on php 4.2.x
(no globals) or they simply do not write a cookie under IIS/IE
Thanks in advance
Shaun Williams
www.eangulus.com
Set a coockie:
$DomainName=".mydomain.com"; //for domains like www.mydomain.com
$value_I_want_save="This is my cookie!";
$lifetime_in_seconds=time()+3600 //set the cookie to live for 1h
setcookie("myCookie",$value_I_want_save,$lifetime_in_seconds,"/",$DomainName,0);
To read cookie:
if (!empty($_COOKIE)) {
extract($_COOKIE);
} else if (!empty($HTTP_COOKIE_VARS)) {
extract($HTTP_COOKIE_VARS);
}
echo $myCookie; //the output will be This is my cookie!
I hope it helps, should work under both Apache and IIS, with any cookie using
browser, and works even if global variables are sett off.
//Aho
No cookie is written and I do have cookies turned on.
"J.O. Aho" <us...@example.net> wrote in message
news:akkiut$1j048n$1...@ID-130698.news.dfncis.de...
Enable display_errors in php.ini - you likely are generating an error, but
have error supression disabled... if I had to guess, I would say that you
are doing something that outputs info to the browser before you try to set
the cookie. (this could be a blank line or anything...)
Either way, the proper place for this is comp.lang.php - please post to
comp.lang.php, not alt.php.
2. How on earth can you say this question doesn't belong here on alt.php?
Its a PHP question. Or does alt.php mean Alternatives to PHP???
"Agelmar" <ifetteNOs...@comcast.net> wrote in message
news:akmqjf$1kcrg3$1...@ID-30799.news.dfncis.de...
Is it possibly a permissions issue? Have you turned on
display_errors to see what that provides?
> 2. How on earth can you say this question doesn't belong here on alt.php?
> Its a PHP question. Or does alt.php mean Alternatives to PHP???
Agelmar's on a mission to get people NOT to use this group and to
use comp.lang.php instead. This group's not going away anytime
soon, though, so use whichever you like. There are still plenty of
people here willing to help and learn. If you use both, though,
make sure to CROSS-POST (post to both at once) and not MULTI-POST
(post to both separately).
-- jeff