I have a problem with cookies, this is my code right below, but i get the Cannot modify headers error. I read that this happens once you send info to the user, but I didn't send anything. Did I?
Any help would be appreciated. Thanks!
<?php
$activities=array("Play Guitar","Write \"Timeless Legend\"","Develop","Dungeons and Dragons Quest","Photography","Android");
$used[0]=null;
$used[1]=null;
$used[2]=null;
$used[3]=null;
$used[4]=null;
$used[5]=null;
if (isset($_COOKIE['cookiesSet'])){
for($h=0;$h<=5;$h++){
$used[$h]=$_COOKIE[$h];
}}
else{
for ($i=0; $i<=5;$i++){
$rand=rand(0,5);
while($used[$rand]!=null){
$rand=rand(0,5);}
$used[$rand]=$activities[$i];
}
$midnight = strtotime('midnight', time());
for ($p=0;$p<=5;$p++){
setCookie($p,$used[$p],$midnight);
}
setCookie('cookiesSet','pollin',$midnight);
}
?>
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>Time Manager</TITLE>