(Added

 tags around the code -- NogDog)[/i]

I am having some difficulty positioning the created html table from a MySQL table. The problem seems trivial but I cannot figure it out.

The html table data is being created in a do ... while loop and what appears to be happening is that the table starts (the heading) after x blank lines where x is the number of rows in the MySQL table. I simply would like my html table to start at the top of the web page after my banner graphics.

The code is:
[code=php]
<html>

<body>

<img src ="citrus_banner4.jpg" name="citrus_banner" align=left width=1480 height=140 border=0>
<?php

echo '<form name="myform" method="post" action="receive-form.php">';
echo "<table border=1>";
echo "<tr><td><b>Customer</b></td><td><b>Telephone</b></td><td><b>Oranges</b></td><td><b>Grapefruits</b></td><td><b>Tangerines</b></td><td><b>Variety</b></td><td><b>\$Order</b></td><td><b>\$Paid</b></td><td><b>\$Owing</b></td><td><b>Picked Up</b></td><td><b>Comments</b></td>";


$db = mysql_connect("localhost", "root","password");

mysql_select_db("citrus_fundraiser",$db);


   $result = mysql_query("SELECT * FROM customers",$db);
   $result2 = mysql_query("SELECT * FROM prices",$db);

if ($myrow = mysql_fetch_array($result)) {
    $myrow2 = mysql_fetch_array($result2);

  do {
    $cn = sprintf("%s %s",$myrow["firstname"],$myrow["lastname"]);
    $ordered = ($myrow["citrus1"]*$myrow2["citrus1_price"])+($myrow["citrus2"]*$myrow2["citrus2_price"])+($myrow["citrus3"]*$myrow2["citrus3_price"])+($myrow["citrus4"]*$myrow2["citrus4_price"]);
    $owing = $ordered - $myrow["paid"];
    $total_order = $myrow["citrus1"] + $myrow["citrus2"] + $myrow["citrus3"] + $myrow["citrus4"];
?>        
<tr bgcolor='red'><td><input type="text" name="cn_a[]" value="<?php echo $cn?>"></td> <td><input type ="text" size ="12" name="phone_a[]" value="<?php echo $myrow["phone"]?>"></td> <td><input type ="text" size ="6" name="citrus1_a[]" value="<?php echo $myrow["citrus1"]?>"></td> <td><input type ="text" size ="11" name="citrus2_a[]" value="<?php echo $myrow["citrus2"]?>"></td> <td><input type ="text" size ="10" name="citrus3_a[]" value="<?php echo $myrow["citrus3"]?>"></td> <td><input type ="text" size ="10" name="citrus4_a[]" value="<?php echo $myrow["citrus4"]?>"></td> <?php printf("<td>%01.2f</td>", $ordered); ?> <td><input type ="text" size="5" name="paid_a[]" value="<?php echo $myrow["paid"]?>"></td> <?php printf("<td>%01.2f</td>", $owing);?> <td><input type ="text" size="9" name="pickedup_a[]" value="<?php echo $myrow["pickedup"]?>"></td> <td><input type ="text" size="25" name="comments_a[]" value="<?php echo $myrow["comments"]?>"></td></tr><br> <?php } while ($myrow = mysql_fetch_array($result)); }
echo "</table>\n"; ?> <?php <input type="submit" name="mysubmit" value="Submit"> </form> } ?> </body> </html>

    My guess is that it is a HTML/CSS issue rather than a PHP issue. It might help if you did a "view source" on the resulting HTML in your browser, then copy and past that in a reply. (Or, if it's on-line somewhere, just provide a link to it.)

      Here is the code (after chopping many of the rows -- in order to post) from View Page Source in the browser:

      <html>

      <body>

      <img src ="citrus_banner4.jpg" name="citrus_banner" align=left width=1480 height=140 border=0>
      <form name="myform" method="post" action="receive-form.php">
      <table border=1 align="center">
      <p><b>This is not good</b></p><br>
      <tr>
      <th>Customer</th>
      <th>Telephone</th>
      <th>Oranges</th>
      <th>Grapefruits</th>
      <th>Tangerines</th>
      <th>Variety</th>
      <th>$Order</th>
      <th>$Paid</th>
      <th>$Owing</th>
      <th>Picked Up</th>
      <th>Comments</th>
      </tr>
      <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>

          <td><input type ="text" size ="12" name="phone_a[]" value="408 726 2789"></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="0"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="0"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="0"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="0"></td>
          <td>0.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
          <td>0.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="0"></td>
      
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value=""></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="0"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="0"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="0"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="0"></td>
          <td>0.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
      
          <td>0.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="0"></td>
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value="408 749 4448"></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="1"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="1"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="1"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="1"></td>
      
          <td>106.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
          <td>106.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="4"></td>
          <td><input type ="text" size="25" name="comments_a[]" value="Large"></td></tr><br>
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value=""></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="1"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="1"></td>
      
          <td><input type ="text" size ="10" name="citrus3_a[]" value="1"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="1"></td>
          <td>106.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="32"></td>
          <td>74.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="4"></td>
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value="408 482 0522"></td>
      
          <td><input type ="text" size ="6" name="citrus1_a[]" value="2"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="2"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="0"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="0"></td>
          <td>116.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
          <td>116.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="4"></td>
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>
      
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value="408 829.03"></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="1"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="2"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="1"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="1"></td>
          <td>132.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
          <td>132.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="5"></td>
      
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>
      
          <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="Customer Name"></td>
          <td><input type ="text" size ="12" name="phone_a[]" value="408 825 3096"></td>
          <td><input type ="text" size ="6" name="citrus1_a[]" value="1"></td>
          <td><input type ="text" size ="11" name="citrus2_a[]" value="2"></td>
          <td><input type ="text" size ="10" name="citrus3_a[]" value="1"></td>
          <td><input type ="text" size ="10" name="citrus4_a[]" value="1"></td>
          <td>132.00</td>        <td><input type ="text" size="5" name="paid_a[]" value="0"></td>
      
          <td>132.00</td>        <td><input type ="text" size="9" name="pickedup_a[]" value="5"></td>
          <td><input type ="text" size="25" name="comments_a[]" value=""></td></tr><br>

      </table>
      <input type="submit" name="mysubmit" value="Submit">
      </form>

      </body>

      </html>

        Cleaned up things a bit, added some <head> stuff to make the document valid, and added some CSS styling to get rid of all excess space:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <html lang='en'>
        <head>
        <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
        <title>Citrus</title>
        <style type="text/css">
        #banner {
           margin: 0;
           padding: 0;
           text-align: left;
        }
        #banner img {
           bordern: none;
        }
        #myform {
           margin: 0;
           padding: 0;
        }
        #myform table {
           margin: 0;
           border-collapse: collapse;
           border: solid 1px black;
        }
        #myform th, #myform td {
           border: solid 1px black;
        }
        </style>
        </head>
        <body>
        <div id="banner"><img src ="citrus_banner4.jpg" name="citrus_banner"
        width="1480" height="140" alt="Citrus"></div>
        <form name="myform" id="myform" method="post" action="receive-form.php">
        <table>
        <tr><td><b>Customer</b></td><td><b>Telephone</b></td><td><b>Oranges</b></td><td><b>Grapefruits</b></td><td><b>Tangerines</b></td><td><b>Variety</b></td><td><b>$Order</b></td><td><b>$Paid</b></td><td><b>$Owing</b></td><td><b>Picked Up</b></td><td><b>Comments</b></td>
        <?php
        $db = mysql_connect("localhost", "root","password");
        
        mysql_select_db("citrus_fundraiser",$db);
        
        
           $result = mysql_query("SELECT * FROM customers",$db);
           $result2 = mysql_query("SELECT * FROM prices",$db);
        
        if ($myrow = mysql_fetch_array($result)) {
            $myrow2 = mysql_fetch_array($result2);
        
          do {
            $cn = sprintf("%s %s",$myrow["firstname"],$myrow["lastname"]);
            $ordered = ($myrow["citrus1"]*$myrow2["citrus1_price"])+($myrow["citrus2"]*$myrow2["citrus2_price"])+($myrow["citrus3"]*$myrow2["citrus3_price"])+($myrow["citrus4"]*$myrow2["citrus4_price"]);
            $owing = $ordered - $myrow["paid"];
            $total_order = $myrow["citrus1"] + $myrow["citrus2"] + $myrow["citrus3"] + $myrow["citrus4"];
        ?>        
        <tr bgcolor='red'><td><input type="text" name="cn_a[]" value="<?php echo $cn?>"></td> <td><input type ="text" size ="12" name="phone_a[]" value="<?php echo $myrow["phone"]?>"></td> <td><input type ="text" size ="6" name="citrus1_a[]" value="<?php echo $myrow["citrus1"]?>"></td> <td><input type ="text" size ="11" name="citrus2_a[]" value="<?php echo $myrow["citrus2"]?>"></td> <td><input type ="text" size ="10" name="citrus3_a[]" value="<?php echo $myrow["citrus3"]?>"></td> <td><input type ="text" size ="10" name="citrus4_a[]" value="<?php echo $myrow["citrus4"]?>"></td> <?php printf("<td>%01.2f</td>", $ordered); ?> <td><input type ="text" size="5" name="paid_a[]" value="<?php echo $myrow["paid"]?>"></td> <?php printf("<td>%01.2f</td>", $owing);?> <td><input type ="text" size="9" name="pickedup_a[]" value="<?php echo $myrow["pickedup"]?>"></td> <td><input type ="text" size="25" name="comments_a[]" value="<?php echo $myrow["comments"]?>"></td></tr> <?php } while ($myrow = mysql_fetch_array($result)); } ?> </table> </form> </body> </html>
          Write a Reply...