Page 1 of 1

writing and reading a cookie

Posted: Sat Apr 12, 2003 6:43 am
by mzfp2
just need sum code to write username to a cookie and read it.

Tried scripts already available but they fail to read any value.

Any help?

Posted: Sat Apr 12, 2003 7:11 am
by twigletmac
You can write a cookie using setcookie() and then once you've refreshed the page, you should be able to access it (assuming you've called it username) as $_COOKIE['username'].

Mac

Posted: Sat Apr 12, 2003 8:16 am
by m3mn0n
You can even use sessions. But try to work with cookies first, it's more basic. :)