Hi... I want to make a cookie for my php page on my localhost (IIS). I have tried many ways many times but i cant make it work... So could anyone please give me a code just so i can echo out $variabel on every page i want to have it on... please so i can get things going... Thx knuff
I think that this would do the trick:
setcookie("variable","value",time()+3600,"/","yourdomain.com",0); // Right now this cookie will expire in an hour
I got ths massage:
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\php\bak\bk.php:7) in c:\inetpub\wwwroot\php\bak\bk.php on line 7
Perhaps I didnt fill it in right? switch yourdomain.com to localhost/php/bak/
Did do it wrong?
knuff
That cookie code needs to be placed before any HTML output, you need to place it a the top of every page, like this...
<?php // cookie code // other top code ?> <html> <head> ... etc. ... </html>
HTH