PHP scripts and programs for Beginner to Master

php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master

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.





I'm reading: Error while creating a cookie - Warning: Cannot modify header information...Tweet this!

1 comments:

Hey thanks a lot for sharing such a nice and informative interview questions which are very helpful for attending the interview...........

By the way check out my collection of php interview questions from the following link: php interview questions

Post a Comment