I'm not sure what you mean by saying "add cookie
within html tag". Cookies are part of the http
header, and must be sent before any of the content
(tags, etc) is sent. That's just the nature of http.
To make it work, you must call setcookie() before
any output is sent. Even a single blank space before
your opening <b><?php</b> tag is enough; PHP
will send that as an ordinary space first, and you'll
get the 'headers already sent' error message.