lill87 Posted May 12, 2007 Share Posted May 12, 2007 Im trying to make a cookie activate in a function: function cookieSet() { setcookie("RegCookie", $value, time()+3600*12); } and then activate the function when $error != 1 but i get this error: "Warning: Cannot modify header information - headers already sent by (output started at D:\xampplite\htdocs\register.php:38) in D:\xampplite\htdocs\register.php on line 29" Please tell me how to fix this or another way to make a cookie set when $error != 1 Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/51090-cookie-problems/ Share on other sites More sharing options...
per1os Posted May 12, 2007 Share Posted May 12, 2007 You cannot have anything outputted to the screen before you call setcookie. Look at line 38 as it is printing something to the screen. Link to comment https://forums.phpfreaks.com/topic/51090-cookie-problems/#findComment-251459 Share on other sites More sharing options...
lill87 Posted May 12, 2007 Author Share Posted May 12, 2007 Then how can i make a cookie set when i want it to? or does it HAVE to be set when page load? Link to comment https://forums.phpfreaks.com/topic/51090-cookie-problems/#findComment-251520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.