显示<div>中的<div>错误

时间:2013-04-16 00:51:22

标签: php html

我有这段代码:

<!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" />
<link rel="stylesheet" type="text/css" media="screen" href="Azulmedia.css" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
    background-color: #FFF;
}
-->
</style>
</head>

<body>
<div class="box" style='display:inline-block;'><h1><center>Pending Reservations to Approve</center></h1>
<?php

require("aacfs.php");
$result=mysql_query("select * from reservation where signoff='' and status!='Cancelled' order by reservno") or die(mysql_error());
echo "<center><div class='box'><table class='hovertable'>
    <th>Reservation No</th> 
    <th>Booking Date</th> 
    <th>Client Name</th>
    <th>Flight Date</th>
    <th>Aircraft</th>
    <th>Itinerary</th>
    <th>ETD</th>
    <th>ETA</th>
    <th>Confirmation Cut Off</th>
    <th>Status</th>
    <th>Reserved By</th>
    </tr>";
    if(mysql_num_rows($result)>0)
    {
        while($row=mysql_fetch_array($result))
        {
            $rvno=$row['reservno'];
            $rn="2012-".$rvno;
            echo"<tr><td>".$rn."</td><td>".$row['bdate']."</td><td>".$row['cliename']."</td><td>".$row['fdate']."</td><td>".$row['acode']."</td><td>".$row['itinerary']."</td><td>".$row['etd']."</td><td>".$row['eta']."</td><td>".$row['cutoff']."</td><td>".$row['status']."</td><td>".$row['adminid']."</td></tr>";

        }
    }
    else
    { ?>
        <tr><td colspan="14" style="text-align:center; color:#FF0000; font-size:16px;">*No Data Available*</td></tr>
        <?php
    }
    echo "</div>";
        ?>
</div>
</br>
<div class="box" style='display:inline-block;'><h1><center>PTR to Edit</center></h1>
<?php

//require("aacfs.php");
$result1=mysql_query("select * from reservation where (etd < now() and status = 'Confirmed' and signoff!='') or (allowed='yes') order by reservno") or die(mysql_error());
echo "<center><div class='box'><table class='hovertable'>
    <th>Reservation No</th> 
    <th>Booking Date</th> 
    <th>Client Name</th>
    <th>Flight Date</th>
    <th>Aircraft</th>
    <th>Itinerary</th>
    <th>ETD</th>
    <th>ETA</th>
    <th>Confirmation Cut Off</th>
    <th>Status</th>
    <th>Reserved By</th>
    </tr>";
    if(mysql_num_rows($result1)>0)
    {
        while($row1=mysql_fetch_array($result1))
        {
            $rvno=$row1['reservno'];
            $rn="2012-".$rvno;
            echo"<tr><td>".$rn."</td><td>".$row1['bdate']."</td><td>".$row1['cliename']."</td><td>".$row1['fdate']."</td><td>".$row1['acode']."</td><td>".$row1['itinerary']."</td><td>".$row1['etd']."</td><td>".$row1['eta']."</td><td>".$row1['cutoff']."</td><td>".$row1['status']."</td><td>".$row1['adminid']."</td></tr>";

        }
    }
    else
    { ?>
        <tr><td colspan="14" style="text-align:center; color:#FF0000; font-size:16px;">*No Data Available*</td></tr>
        <?php
    }
    echo "</div>";
        ?>
</div>

</body>
</html>

它应该首先显示Pending Reservations to Approve然后显示它的表,然后显示PTR to Edit然后它的表。但它显示如下:

enter image description here

我如何分开这两张桌子? Pending Reservations to Approve标题和表格首先是PTR to Edit标题和表格。

1 个答案:

答案 0 :(得分:1)

你没有关闭很多标签。 "<center><div class='box'><table class='hovertable'> - 您不会关闭<table>,而是关闭<center>echo "</div>";实际应该是echo "</table></div></center>";