Kamis, 17 Desember 2009

Error while creating a cookie - Warning: Cannot modify header information...

Hi,
Are you getting this kind of error when creating a cookie or setting a cookie -

Warning: Cannot modify header information - headers already sent by (output started at e:\wamp\www\mysite\test.php:3) in e:\wamp\www\mysite\test.php on line 4

This error comes when some data is sent to the browser before setting the cookie.
So setcookie or setrawcookie function should be the first to be called means,

setcookie or setrawcookie function should be the first line on your page.


So if you use code like this








so the above code will give error.

So you should do following thing.





Tidak ada komentar:

Posting Komentar