Please see the PHP documentation for set cookie: http://php.net/setcookie
Examples are toward the bottom of the page.
Note: You can only set a cookie for the pages current domain. IE A page at
www.something.com can set a cookie for
.something.com but not
.youtube.com. This is to the security of web communications and is endorsed by the browser.