Hi,

I have a html file Top.htm:

<form action="" method="post">
    <fieldset>
        <input id="searchbox" type="text" name="zoekfunctie" value="Zoek..." />
        <input type="submit" name="zoekbutton" value="Zoek" />
    </fieldset>
</form>

I then include this page in my index page (and in many more pages to come):

<div id="top">
        <?php
            include("Top.htm");
        ?>
    </div>

Now the problem is that, for wathever reason there may be, an empty line gets inserted above the html form: Here. However, when I don't include the code, but I just put it in the index page:

<div id="top">
        <form action="" method="post">
            <fieldset>
                <input id="searchbox" type="text" name="zoekfunctie" value="Zoek..." />
                <input type="submit" name="zoekbutton" value="Zoek" />
            </fieldset>
        </form>
    </div>

Than it looks like this: Here

This is the case with every browser. Does anyone has an idea what the problem is, and how to solve it?

Thank you

Both of these pages look identical to me in chrome. However the code you have posted isn't present in the source code of either, would that be because Im not logged in?

Member Avatar for diafol

Perhaps if you showed some screenshots of the problem? Looks the same to me as well.

I've added new images, now in attachments: notice the extra line marked with a red circle. I hope you now understand what I want to say. The first picture is the one with the include.

Member Avatar for diafol

From the link you gave this is what I see:


Doesn't look anything like the screenshot you posted!

From the link you gave this is what I see:

Doesn't look anything like the screenshot you posted!

My apologies, but the link works apparently only for me (because I was logged in at the site). So again my apologies for that, however the correct images were uploaded in the previous reply and now again.

Have a look at the html source code and see what's creeping in.

Member Avatar for diafol

Yes sounds odd. Is your htm file completely empty except for the form itself? It shouldn't have a doctype declaration / body tag or anything else, right?

Have a look at the html source code and see what's creeping in.

The source code doesn't show anything weird. So I can't notice any empty line insertion. However I uploaded two pics: one with firebug and one with the chrome element inspector. In chrome it shows a " " between the div and the form element. And in firebug an empty line.

Yes sounds odd. Is your htm file completely empty except for the form itself? It shouldn't have a doctype declaration / body tag or anything else, right?

Yes, it is completely empty.

Member Avatar for diafol

Well, seems to me as if you've got some sort of output before the form. I suggest that you create a new txt file and hand type the code again. Save it.
Only the form markup should be placed in it - absolutely nothing else. Some text editors save a 'BOM' as a header in the text file. If you're able in your editor, ensure that you 'encode in UTF-8 without BOM'.

I once had display problems due to BOMs being present (usually invisible in the text editor). Drove me absolutely nuts for days.

Well, seems to me as if you've got some sort of output before the form. I suggest that you create a new txt file and hand type the code again. Save it.
Only the form markup should be placed in it - absolutely nothing else. Some text editors save a 'BOM' as a header in the text file. If you're able in your editor, ensure that you 'encode in UTF-8 without BOM'.

I once had display problems due to BOMs being present (usually invisible in the text editor). Drove me absolutely nuts for days.

Thank you very much. I rewrote it in notepad and it now works as expected!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.