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! Quote 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. Quote 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? Quote Link to comment https://forums.phpfreaks.com/topic/51090-cookie-problems/#findComment-251520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.