Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Can't set cookie or redirect.
I have this 3 commands: setcookie("user", $userid, time()+3600); setcookie("pass", $userpw, time()+3600); header("location: profile.php");
And this error: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\website\header.php:133) in C:\xampp\htdocs\website\login.php on line 25
Dovid Gefen3,341 Points
In order for setcookie() to work it must be placed above all the Html in your code including the doctype so that the cookie gets set before the header is sent.