I have made complex a page, with tables and phps, in Dreamweaver. The page looks fine in browser, but the tables look messed up when in Dreamweaver.
In code view, it marks this tags as invalid/

```
<?php

if ( !$_COOKIE['user'] ) { die( '<meta http-equiv="refresh" content="3;URL=index.php">Please your enable cookies.' ); }

$database = mysqli_connect('localhost', 'root', 'marina', 'art24_database') or die('Error connecting to MySQL server.');

$result = mysqli_query($database, "SELECT * FROM irnieki WHERE USER_NAME = '".$_COOKIE['user']."' and PASSWORD = '".$_COOKIE['pass']."' " );
if ( !$result ) { die('<meta http-equiv="refresh" content="3;URL=index.php">Invalid username or password.'); }

$row = mysqli_fetch_array($result);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Artilerijas 24</title>
<style type="text/css">
<!--
body {
    background-color: #E7E6E0;
}
body,td,th {
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 12px;
}
.inputtable {
    background-color: #F5F4F3;
    border: 1px solid #CDCBC7;
}
#apDiv2 {
    position:absolute;
    width:148px;
    height:200px;
    z-index:2;
    left: 51px;
    top: 169px;
    background-color: #FF6B09;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 14px;
    color: #FFF;
    padding: 15px;
    border: 1px solid #A83200;
    background-image: url(gfx/apdiv.png);
}
#apDiv1 {
    position:absolute;
    width:173px;
    height:74px;
    z-index:1;
    background-image: url(gfx/coffee1.png);
    left: 54px;
    top: 98px;
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-position: center center;
}

p.big {
  line-height: 215%;
}

-->
</style></head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="apDiv2"><b>Skaitītāji
<br><br>
Vēl kaut kas
<br><br>
Un vēl-vēl kaut kas
<br><br>
Te arī kaut kas interesants
</b></div>
<br>
<center><img src="gfx/coffee1.png" width="292" height="72" /></center>
<div id="apDiv1"></div>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="25" align="left" valign="top" bgcolor="#FFFFFF"><img src="gfx/frame_ctl.png" width="25" height="51" /></td>
    <td height="25" align="center" valign="top" background='gfx/frame_topbg.png' bgcolor="#FFFFFF"><img src="gfx/frame_top.png" width="400" height="51" /></td>
    <td height="25" align="left" valign="top" bgcolor="#FFFFFF"><img src="gfx/frame_ctr.png" width="25" height="51" /></td>
  </tr>
  <tr>
    <td width="25" align="center" background='gfx/frame_left.png' bgcolor="#FFFFFF"><br>
      <br>
      <br>
    <br>
    </td>

    <td width="750" align="center" bgcolor="#FFFFFF">    
<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->

    <?php

    echo 'Laipni lūdzam, '.$row['UZVARDS'].'!';

    $dzivarray = array();

    array_push($dzivarray, 'Nams Artilērijas 24');

    $result = mysqli_query($database, "SELECT * FROM irnieki ORDER BY 'ID'" );
    while ( $row = mysqli_fetch_array($result) ) { if ( $row['DZIVOKLIS'] != '' ) { $dzivarray[$row['DZIVOKLIS']] = $row['DZIVOKLIS']; }}

    if ( isset($_POST['submitrad']) ) {

        if ( $_POST['karstuddziv'] != '' && $_POST['aukstuddziv'] != '' ) {
mysqli_query($database, "INSERT INTO dynamic (DATE,DZIVOKLIS,UDENS_AUKST,UDENS_KARST)
                        VALUES ('".$_POST['newdate']."','".$_POST['dziv']."','".$_POST['aukstuddziv']."','".$_POST['karstuddziv']."')" );
        $status = '<font color = "#00CC00"> SAGLABĀTS.</font>';

        } else { $status = '<font color = "#FF0000">NAV SAGLABĀTS, RĀDĪJUMS NAV IEVADĪTS.</font>'; }

        }

    ?>

<br><br><br><br><br>

<table width="550" border="0" cellspacing="0" cellpadding="0"><tr>
<td><font color="#595454">Lūdzu ievadiet rādījumus: </font></td></tr></table><br>
<table width="600" border="0" cellpadding="0" cellspacing="0" class="inputtable"><tr>
<td height="120" align="center" valign="middle" bgcolor="#F5F4F3">
<form name=formdziv action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td width="26%" align="center" valign="middle">Dzīvoklis<br /><br />
<select name="selectdziv" id="selectdziv" onchange=" formdziv.submit(); " >

<?php  foreach ($dzivarray as $x ) {

$result = mysqli_query($database, "SELECT * FROM irnieki WHERE DZIVOKLIS = '".$x."' " );
$row = mysqli_fetch_array($result);
$name = $row['UZVARDS'];

    echo '<option ';
    if ( $x == $_POST['selectdziv'] ) { echo 'selected'; }
    echo ' value = "'.$x.'" >'.$x.' - '.$name.'</option>' ; }

echo '</select>';

if ( $_POST['selectdziv'] == 'Nams Artilērijas 24' || $_POST['selectdziv'] == '' ) { echo'<br><br><br><br><br><br><br><br><br><br><br><br>'; }

?>

</td><td width="49%" align="right" valign="middle">
<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->

<?php

if ( $_POST['selectdziv'] == "Nams Artilērijas 24" || $_POST['selectdziv'] == '' ) {

echo '
<br><br>Ūdens rādīījumi <input name="udrad" type="text" id="textfield" size="11" value="'.$_POST["karstuddziv"].'" /><br>
<br>"Rīgas Ūdens" rēķins (LVL) <input name="udrekins" type="text" id="textfield" size="11" value="'.$_POST["karstuddziv"].'" /><br>
<br>Siltums rādīījumi <input name="udrad" type="text" id="textfield" size="11" value="'.$_POST["karstuddziv"].'" /><br>
<br>"Rīgas Siltums" rēķins (LVL) <input name="siltrekins" type="text" id="textfield" size="11" value="'.$_POST["karstuddziv"].'" /><br>
<br>Elektrības rādījum <input name="elrad" type="text" id="textfield2" size="11" value="'.$_POST["aukstuddziv"].'" /><br><br><br><br><br>';

} else {

echo'
<br>Karstais Ūdens <input name="karstuddziv" type="text" id="textfield" size="11" value="'.$_POST["karstuddziv"].'" /><br>
<br>Aukstais Ūdens <input name="aukstuddziv" type="text" id="textfield2" size="11" value="'.$_POST["aukstuddziv"].'" /><br><br>
'; }

?>

</td><td width="25%" align="center" valign="middle">
<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->

<?php
if ( !$_POST['selectdziv'] ) { $dziv = $dzivarray[0]; } else { $dziv = $_POST['selectdziv']; }

    if ( $dziv != "Nams Artilērijas 24" ) {

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE DZIVOKLIS = '$dziv' AND UDENS_AUKST != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }

        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }

        echo $newdate;

        echo '<input type="hidden" name="newdate" value="'.$newdate.'">';
        echo '<input type="hidden" name="dziv" value="'.$dziv.'">';

        } else {

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE UDENS_RAD != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }
        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }
        echo '<br><p class="big">'.$newdate.'';     

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE UDENS_RAD != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }
        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }
        echo '<p class="big">'.$newdate.'';             

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE UDENS_RAD != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }
        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }
        echo '<p class="big">'.$newdate.'';             

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE UDENS_RAD != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }
        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }
        echo '<p class="big">'.$newdate.'';             

        $result = mysqli_query($database, "SELECT * FROM dynamic WHERE UDENS_RAD != '' ORDER BY 'ID' ASC" );
        while ( $row = mysqli_fetch_array($result) ) { $newdate = $row['DATE']; }
        if ( $newdate != '' ) {
            $newdate = strtotime(date("d.m.Y.", strtotime($newdate)) . " +1 month");
            $newdate = date("d.m.Y.", $newdate); } else { $newdate = '01.06.2010.'; }
        echo '<p class="big">'.$newdate;    

        }

?>

<br /><br />
<input type="submit" name="submitrad" id="button" value="Saglabāt" <?php if ( $status == '<font color = "#00CC00"> SAGLABĀTS.</font>' ) { echo 'disabled'; } ?> /><br>
</td></tr></table></form></td></tr></table><br /><?php echo $status; ?>
<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->

<br>
<br><br><br><br><br>

    <td width="25" align="center" background='gfx/frame_right.png' bgcolor="#FFFFFF"></td>
  </tr>
  <tr>
    <td align="left" valign="bottom" bgcolor="#FFFFFF"><img src="gfx/frame_cbl.png" width="25" height="25" /></td>
    <td height="25" align="center" background='gfx/frame_btm.png' bgcolor="#FFFFFF">&nbsp;</td>
    <td align="right" valign="bottom" bgcolor="#FFFFFF"><img src="gfx/frame_cbr.png" width="25" height="25" /></td>
  </tr>
</table>
<font color="grey"><center><br>
Namīpašums Artilērijas 24
</center></font>
&nbsp;
&nbsp;
&nbsp;
</body>
</html>

```

But they do work normally for the browser. Any ideas?

EDIT:
I copied the whole code and marked place where the error might be coming from with `"<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->"`