PHP将数据库数据显示到HTML表中

I have the following scenario. MySQL database and PHP page that get a set of user data from the database and displays them in a table. The code works fine and it is as follows:

<form id="iform" name="iform" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>">

<table class="tabcont" width="100%" valign="center" border="0" cellpadding="0" cellspacing="0" summary="main area">

              <tr><td align="center" class="listlr" colspan="2">

</td></tr>

              <tr><td align="center" class="listlr" colspan="2">

              </td></tr>

<?php if (is_array($result) && count($result) > 0): 
              foreach ($result as $reskey => $resvalue) {
                     echo "<tr><td width='30%'>{$reskey}:</td>";
                     echo "<td width='70%'>";
                     if ($reskey == 'PortraitImage')
                           echo "<img id='{$reskey}' src='{$resvalue}' value=''/>";
                     else if ($reskey == 'SignatureImage')
                           echo "<img id='{$reskey}' src='{$resvalue}' value=''/>";
                     else
                           echo "<input class='formfld' id='{$reskey}' value='{$resvalue}'/>";
                     echo "</td></tr>";
              }
else: ?>
                     <tr> <td>
<?php
                     echo "<div align=\"center\" class=\"listtopic\" id=\"iderror\">{$errormsg}</div>";
?>
                     </td>
                     </tr>
<?php endif; ?>
       </table>
       </</form>

What I need to do now is to display the data arranged in another way, in a html table like the one attached (which will have a background image but that's easyly implemented via css). The table needs to be in this format:

HTML Table

I am trying to modify the above code but can't seem to get it right in this table format.

I can certainly display it fine as it is in the above code or in a simple table, but it gets all messed up when I try to display the data in the above table format. Any suggestions based on the above code? Thanks.