Mboard - Warning: Cannot modify header information

Is message board greying out your hair (at least what's left of it)? Let us help you here
Locked
alfatwinspark166
Posts: 2
Joined: Tue Apr 03, 2012 4:06 pm

Mboard - Warning: Cannot modify header information

Post by alfatwinspark166 »

Script URL: mboard
Version of script: 1.3
Hosting company: 1&1
URL of phpinfo.php:
URL of session_test.php: http://bakharla.com/bakharla%20message%20board.php
What terms did you try when SEARCHING for a solution: "Warning: Cannot modify header information"

Write your message below: Hello, Thanks for the scripts. Because I've tried them I know that the scripts work on their own, however I've tried to incorporate the mboard script into my webpage design to match the other pages. I keep getting the errors displayed which you'll see when you have a look at the test page on http://bakharla.com/bakharla%20message%20board.php

I've tried to find solutions going through the previous posts and on the net, yet I just can't seem to solve the problem. I would be grateful if someone can have a quick look and advise me.

Thanks
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Mboard - Warning: Cannot modify header information

Post by Klemen »

You mustn't paste HTML code directly into PHP files as that breaks workflow and may cause all kinds of errors, including the "headers already sent" error. In plain terms this means that some HTML code has been sent to the browser before the script sent out it's code to the browser.

What you should do is either paste your HTML code into "header.txt" and "footer.txt" files or find HTML code inside original mboard.php file and edit it on that exact location rather than pasting it to the top of mboard.php file (search the file for <html> - the code is located twice in the file!).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Mboard - Warning: Cannot modify header information

Post by Henrie »

Indeed, in the http://bakharla.com/bakharla%20message%20board.php page when i view the source code i find the head section

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Bakharla Galleria</title>
<meta name="Author" content="Bakharla.com" />
...
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<!-- Start of StatCounter Code for Dreamweaver -->
and further down in the source code there is another head section

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Bakharla - Message Board</title>
<meta content="text/html; charset=windows-1250">
<link href="style.css" type="text/css" rel="stylesheet">
<script language="Javascript" src="javascript.js" type="text/javascript"><!--
//-->
</script>
</head>
<body>

It is not valid (x)html. It should be

Code: Select all

<!DOCTYPE ... >
<html ... >
<head>
...
</head>
<body>
...
</body>
</html>
Thus only one of each of the above mentioned sections.

Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
alfatwinspark166
Posts: 2
Joined: Tue Apr 03, 2012 4:06 pm

Re: Mboard - Warning: Cannot modify header information

Post by alfatwinspark166 »

Guys,

Many thanks for your help in sorting the problem I had created. The message board is working fine, however I have question relating to it. When a reply is posted and then stored in MSG folder, for eaxample http://bakharla.com/msg/15.html, when that message is opened up for a response, my other pages in the directory show up as being in the MSG folder.

Clearly, I don't have any other pages stored in MSG folder and therefore the standard 404 type response is showed by the host server. I'd like to somehow drop the "msg" from appearing, is that possible? The example below is typical of a page that obviously does not exist. I hope I've explained the problem. In anticipation of your help.

http://bakharla.com/msg/bakharla%20map%20page.html

Thanks

PK
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Mboard - Warning: Cannot modify header information

Post by Klemen »

You will need to use FULL website URLs in header/footer.

At the moment you are using relative URLs, for example:

Code: Select all

href="bakharla galleria page 0.html"
You should be using full URLs starting with http://, for example:

Code: Select all

href="http://bakharla.com/bakharla galleria page 0.html"
Note that any changes you make to your footer/header will only affect new posts, not existing ones.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Locked