views:

25

answers:

1

hi!

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

+1  A: 

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.

Mark Eirich