Cookies are sent in the headers. All headers must be ready before the actual content (the title here) is sent.
That is, you should move the set cookie line before the <html>
appears.
KennyTM
2010-05-30 13:23:38