If you want to use cookies, just use the code:
setcookie("variable", "value");
But this has to come before any html code in your page; you can't set cookies in the middle of a page.
Also, this cookie will expire when the user leaves your website, unless you include an expire time at the end.
As well, if your user has cookies disabled, your code won't work.
hth
-Elizabeth