cookies don't always work in PHP I've found, unless there is a time a place to set them?
Is it true that the code has to appear before any HTML tags? I don't think this is true. I have a cookie working fine on one site, copied the code to another site and the cookie will not create on this new site!!
Here is what I am doing. It's a bit involved.
$date = date("Ymd");
if(!isset($custid))
{
mysql_query("INSERT INTO $customers_table (new, signupdate) VALUES(1, '$date')");
$cid = mysql_query("SELECT MAX(id) AS maxid FROM $customers_table");
$cid2 = mysql_fetch_array($cid);
$maxid = $cid2[maxid];
}
if(isset($maxid))
{
setcookie("custid", $maxid ,time()+14400,"/",".skin-perfect.com",0);
}
END OF CODE.
If I display $custid, it has no value! I should be able to display this variable anywhere on the site after this code has executed.