Php header function

I am currently working my way through ‘Build Your Own Database Driven Website Using PHP & MYSQL’ by Kevin Yank and have come across a problem using the header (‘Location: .’) function. It works OK on my own computer but when I try to view the same site on my hosting server I get an error Warning: Cannot modify header information - headers already sent by (output started at /path/includes/ in /path/admin/jokes/index.php on line 228

I have used the code-archive version that I downloaded with the book. And I have read the posts about white space before the php tag, this made no difference.

Any help would be much appreciated (By the way I am a novice)


What URL are you using as the location? Is it because you’re directing to a local location that is protected or does not exist on the hosting server?

What’s on line 3 of

Thank you StarLion you solved it.

I did have some white space before and after the php tags in my include file and didn’t realise that would cause the problem. I only checked for white space in the controller index file.

After deleting the empty lines in the file, everything worked fine!

Thanks once again.