Dreamweaver中表的问题:)

时间:2010-06-24 12:23:41

标签: html html-table dreamweaver

我在Dreamweaver中制作了一个带有表格和phps的复杂页面。该页面在浏览器中看起来很好,但在Dreamweaver中表格看起来很乱。 在代码视图中,它将此标记标记为无效/

<?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>

但它们确实可以正常用于浏览器。有什么想法吗?

编辑: 我复制了整个代码,并使用"<!-- MIGHT BE SOMETHING WRONG WITH THE LINE ABOVE! -->"

标记了错误可能来自的位置

2 个答案:

答案 0 :(得分:1)

取出段落标记:</p><p> - 如果它们位于表格元素内的任何位置,而不是它们周围。它们似乎也是错误的顺序,但这可能只是因为你只向我们展示了一行。

答案 1 :(得分:1)

如果它在浏览器中显示正常,则可能只是Dreamweaver的问题。

您是否尝试使用one of the w3c validators验证生成的HTML?这可能会产生更多有用的信息。