当存在其他表单时,调用HTML文件的PHP表单不起作用

I have multiple forms in a PHP file that I call with the 'include' command. If I put the include command before the other forms in the HTML page then it works. The problem is that I need to call the 'include' command below the other forms. The solution I came up with was to call the PHP file at the beginning of the page and hide the div. I then called the file again at the bottom of the page which fixed the problem. Is there another solution? Why is it doing this?

Non working example:

    <form></form>
    <form></form>
    include 'phpfilewithotherforms.php';

working example but not viable:

    include 'phpfilewithotherforms.php';
    <form></form>
    <form></form>

working example:

    <div style="display:none;">include 'phpfilewithotherforms,php';</div>
    <form></form>
    <form></form>
    include 'phpfilewithotherforms.php';

Sample of PHP file that I'm calling:

    while($row = mysql_fetch_array($result))
    {
    echo "<div style='padding:20px;margin:15px;background:offwhite;border-style:solid;border-width:1px;border-color:lightgray;'>" .
    "<form method='post' name='example'>" .
    "<span class='detail'><b>Title:</b>  " .  
    $row['mytitle'] .
    "      " .
    "<input type='hidden' value='" . stripslashes($row['mytitle']) . "' . name='title'>" .
    "<span style='float:right'>" .
    "<input type='submit' value='Edit' name='edit'>" .
    "<input type='submit' value='Preview' name='preview'>" .
    "</span>" .
    "</form>" .
    }

You have to work in order. I would split the included file in two, one with the code needed before forms, and the other with the code needed after forms.

I usually write PHP inside HTML with <? PHP CODE ?>

<div style="display:none;"><?include 'phpfilewithotherforms,php';?></div>

Are you missing those?