August 15th, 2000, 12:25 AM
Thank you for reading this.
I'm setting cookie with PHP3 function
setcookie(); in one script.
I get no warning while processing
the script, but when I try to read the
cookie in another script nothing is returned. I tried several combinations, but still no result.
Can you tell me what's the problem?
Thank you a priori.
August 15th, 2000, 05:42 AM
Format for setting cookies:
<?php setcookie("theuser",$Username,time()+31536000); ?>
(Do this at the top of the page before you do anything else like send headers or it doesn't work.)
$Username=what is set
time()+31536000=time in seconds
If you set a cookie for time(), that's a trick for having it expire immediately. That may be your problem.
Retrieving cookies: $theuser.
btw- This isn't really an advanced question, or I wouldn't know the answer. lol.
So you'll get more replies next time if you don't title it that way.
August 15th, 2000, 10:03 AM
I always had trouble with cookies also. But how can i set a cookie that'll never expire?
August 15th, 2000, 10:16 AM
you can check wether cookie has been set or not using..
echo "Cookie has been setn";
echo "could not set cookien";
here is a cookie example.
make sure that you are passing the values to 4th and 5 th argument.Otherwise your cookie won't available through out your site.
you can retreive a cookie using cookiename.
www.jobxyz.com-IT Career Portal
"The fear of the LORD is the beginning of knowledge..."