I have a code which querys the mysql database and creates a user input table, a fixed number of columns but the number of rows depends on the number of results found by the query.
It appears that for every row returned by the query, the code is putting a blank line before the form.
This isn't an issue when there are only a couple of records returned, because the the form only moves a couple of lines down the page, but when 20+ records are returned the form moves so far down the page you have to scroll down to find it...
I have looked over the code and cannot see what might be causing this - can anyone help - thanks
$Office = $_POST['Office'];
$query = "SELECT `OfficeId` FROM `tblOffice` WHERE `OfficeName` = '$Office'";
$result2 = mysql_query($query)
or die (mysql_error());
$row2 = mysql_fetch_array($result2);
$OfficeRef = $row2["OfficeId"];
echo "<font face=\"Arial, Helvetica, sans-serif\"><p> The Input for <b>$CoName</b> are as follows,</p></n></n></n>
</font>";
//list equipment
$query = "SELECT (type) AS type, (Option) AS Option, (CommonName) AS Location, (Id) AS Id,
(Ident) AS Ident FROM `Office` WHERE OfficeRef = '$OfficeRef' ";
$result11 = mysql_query($query)
or die(mysql_error());
if ($result11)
{
echo' <form action="process_readings.php" method="POST" style="MARGIN: 0px;">
<table align="centre" cellspacing="0" cellpadding="0">
<tr valign="top">
<td align="left"></td>
<td align="left"><b>Type</b></td>
<td align="left"><b>Option</b></td>
<td align="left"><b>Location</b></td>
<td align="right"><b>Code</b></td>
<td align="left"></td>
<td align="left"><b>Input</b></td>
<td align="left"></td>
<td align="left"></td>
</tr >';
while ($row11 = mysql_fetch_array($result11,MYSQL_NUM))
{
echo "<td width=\"10\" align=\"left\"><input type=\"hidden\" name=\"Ident\" value\"{$row2[4]}\"></td>
<td width=\"70\" align=\"left\"> {$row11[0]}</td>
<td width=\"120\" align=\"left\"> {$row11[1]}</td>
<td width=\"200\" align=\"left\"> {$row11[2]}</td>
<td width=\"30\" align=\"right\"> {$row11[3]}</td>";
if ($row11[4] == 1)
{
echo "<td width=\"10\" align=\"left\"> {$row11[7]} <input type=\"text\" name=\"Id[]\" size=\"3\"></td>
<td width=\"200\" align=\"left\"> {$row11[5]} Size <input type=\"text\" name=\"Size[]\"></td>
<td width=\"300\" align=\"left\"><input type=\"hidden\" name=\"Colour[]\" value\"{NULL}\"></td><br> ";
}
else
{
echo "<td width=\"1\" align=\"left\"> {$row11[7]} <input type=\"text\" name=\"Id[]\" size=\"3\"></td>
<td width=\"200\" align=\"left\"> {$row11[5]} Size <input type=\"text\" name=\"Size[]\"> </td>
<td width=\"300\" align=\"left\"> {$row11[6]} Colour <input type=\"text\" name=\"Colour[]\"></td><br> ";
}
echo "</font></tr valign=\"top\">\n";
} //close while loop
} //close main if
echo '</table>';
echo "<br><p align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Submit\"> ";
echo '</form>';