Header may not contain more than a single header, new line detected…

You may get this error when you are dealing with lot of variables and trying to passing those variable to header and by a mistake you have new line in your header string.

i was getting this following error when redirecting after form submit..

“Warning: Header may not contain more than a single header, new line detected. in /home/gedforad/public_html/index.php on line 60”

So i was thinking there may be the problem with redirect it with lot of variables but it was not!

there may be you have some code like this

[php]

$post_url="Location: http://webservices.somewebsite.com/default.ashx?"."&state=".$state."&country=".$country;

header($post_url);

[/php]

Or whatever code you have with lot of variable.its most common when press enter to go to new line.

here i am using location within string , otherwise actual code should be(this is also a way to avoid errors):

[php]

$post_url="http://webservices.somewebsite.com/default.ashx?"."&state=".$state."&country=".$country."&email=".$email."&ReturnToURL=".$ReturnToURL;

header("Location: $post_url");

[/php]

you will get an error if you will have some new line in your $post_url variable string.

just test your code again and remove new line in your code, you can post lot of variable through browser.