Reputation: 699
Ive designed a login form in php where the script sets a cookie and then redirects the the user to another page.
But it shows the error
Warning: Cannot modify header information - headers already sent by
How can i overcome this?
Please help. Thanks
Upvotes: 0
Views: 319
Reputation: 10114
You are likely trying to redirect using the header() function, but your PHP script has already printed something. Make sure you aren't outputting anything before cookie-setting and redirecting.
This may require rearranging your code in general. If it isn't practical to do so, you may also set cookies and redirect using Javascript. However, anyone who has disabled Javascript will of course be left out.
Upvotes: 1