The basic idea behind cookies is very simple. The site stores a little bit of info on the users computer, which can be accessed at a later point in time. The info stored can be anything, but usually consists of the users username, password, etc. for that particular site.

PHP Code:
// basic syntax
setcookie("stuff to store"$variable"expiration date");

//example, expires 1 year after the cookie is stored
setcookie("stuff"$var1time()+31104000);

//to retrieve cookie
$var1 $_COOKIE['var1']; 
Any questions/comments, please feel free to contact me.