require_once on a while
<p>I have this code:</p>

<pre><code>while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
    if($i++%2==0){
       $color="#FFFFFF";
    }else{
       $color="#CCCCCC";
    }

    ?&gt;

    &lt;tr bgcolor='&lt;?php echo $color; ?&gt;' onmouseover="this.style.background='#ABFB04';" onmouseout="this.style.background='&lt;?php echo $color; ?&gt;';"&gt;
    &lt;?php

echo "&lt;td class=tablelist&gt;";

echo $row["ICAO"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["Name"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["WeightEmpty"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["WeightFull"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["CargoFull"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["Range"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["Price"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["FirstClassSeats"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["BusinessClassSeats"] . '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo $row["EconomyClassSeats"]. '&lt;/td&gt;&lt;td class=tablelist&gt;';

echo "&lt;img class='editaircraft' src='./images/info.png'&gt;&lt;/td&gt;&lt;/tr&gt;"; 

?&gt;
&lt;script&gt;
    $(function() {
        $( "#editaircraftdialog" ).dialog({
            autoOpen: false,
            width: 425
        });

        $( ".editaircraft" ).click(function() {
            $( "#editaircraftdialog" ).dialog( "open" );
            return false;
        });
    }); 
&lt;/script&gt;

&lt;div id="editaircraftdialog" title="Edit Aircraft"&gt;
    &lt;?php require_once('./new_aircraft.php'); ?&gt; 
&lt;/div&gt;

&lt;?php
}

echo "&lt;/table&gt;";
$pagination-&gt;render();
?&gt;
</code></pre>

<p>The problem is here:</p>

<pre><code>&lt;div id="editaircraftdialog" title="Edit Aircraft"&gt;
        &lt;?php require_once('./new_aircraft.php'); ?&gt; 
    &lt;/div&gt;
</code></pre>

<p>If I use the require once in a while it not works. But if the require is out a while it works fun. If i change the require_once and I put text, It works fun.</p>

<p>The problem is what I see the content of the require_once out a dialog like this: <a href="http://i50.tinypic.com/k1aslk.png" rel="nofollow">http://i50.tinypic.com/k1aslk.png</a></p>

<p>The while stops when it arrive to the <code>&lt;div&gt;</code>.</p>

<p>new_aircraft.php</p>

<pre><code>&lt;script&gt;
    $(function() {
        $("#insertaircraft")
            .button()
            .click(function(event) {
        });
    });
&lt;/script&gt;

&lt;form action="new_aircraft_process.php" method="post" enctype="application/x-www-form-urlencoded"&gt;
    &lt;table&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;ICAO:&lt;/td&gt;&lt;td&gt;&lt;input maxlength="4" type="text" name="icao" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Name:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="name" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Weight Empty:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="weightempty" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Weight Full:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="weightfull" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Cargo Full:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cargofull" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Cruise Speed:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cruisespeed" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Range:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="range" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Price:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="price" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Number Classes:&lt;/td&gt;&lt;td&gt;&lt;select name="numberclasses" id="numberclasses"&gt;
        &lt;option value="0"&gt;Select Number of Classes&lt;/option&gt;
        &lt;?php
        echo '&lt;option value="1"&gt;One Classes (Economy)&lt;/option&gt;';
        echo '&lt;option value="2"&gt;Two Classes (Business &amp; Economy)&lt;/option&gt;';
        echo '&lt;option value="3"&gt;Three Classes (First, Business &amp; Economy)&lt;/option&gt;';
        ?&gt;
    &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;



    &lt;tr&gt;&lt;td class="forms"&gt;First Class Seats:&lt;/td&gt;&lt;td&gt;&lt;input disabled="disabled" type="text" id="firstclassseats" name="firstclassseats" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Business Class Seats:&lt;/td&gt;&lt;td&gt;&lt;input disabled="disabled" type="text" id="businessclassseats" name="businessclassseats" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

    &lt;tr&gt;&lt;td class="forms"&gt;Economy Class Seats:&lt;/td&gt;&lt;td&gt;&lt;input disabled="disabled" type="text" id="economyclassseats" name="economyclassseats" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;script type="text/javascript"&gt;

$("#numberclasses").change(function() {
value = $(this).val();

str = parseInt(value);

switch(str)
  {
    case 0:
    $(document).ready(function() {
        $("#firstclassseats").attr("disabled","disabled");
        $("#businessclassseats").attr("disabled","disabled");
        $("#economyclassseats").attr("disabled","disabled");
});
    break;

    case 1:
    $(document).ready(function() {
        $("#economyclassseats").removeAttr('disabled');
        $("#firstclassseats").attr("disabled","disabled");
        $("#businessclassseats").attr("disabled","disabled");
});
    break;

     case 2:
    $(document).ready(function() {
        $("#businessclassseats").removeAttr('disabled');
        $("#economyclassseats").removeAttr('disabled');
        $("#firstclassseats").attr("disabled","disabled");
});
    break;

    case 3:
    $(document).ready(function() {
        $("#firstclassseats").removeAttr('disabled');
        $("#businessclassseats").removeAttr('disabled');
        $("#economyclassseats").removeAttr('disabled');
});
    break;

  }
});

&lt;/script&gt;

    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input id="insertaircraft" type="submit" value="Insert Aircraft"/&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
&lt;/form&gt;
</code></pre>
