0

我遇到了一个非常烦人的“错误”……我的页面有页眉、左侧边栏和页脚。在我提交表格后,一切都很好,除了现在页脚在页面中间!我尝试了我所知道的一切并进行了搜索,但我仍然无法解决这个问题。

提交前,页脚位于正确位置:http: //i48.tinypic.com/ly1dl.jpg
提交后,页脚位于页面中间:http: //i47.tinypic.com/168a3uq.jpg

这是代码:

标题:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="stylesheets/stylesheet.css" type="text/css" rel="stylesheet" />
<title>Wilson Electric & Alarm Company</title>
</head>
<body>
<div id="header">
<h1 id="toptitle"> Wilson Electric & Alarm Company </h1>
</div>
<div id="navigation_top">
</div>
<div id="column_left">
 <ul id="left_menu">
 <li> <a href="testing2.php"> Insert Page </a> </li>
 <li> <a href="search.php"> Search Page </a> </li>
 <li> <a href=""> Menu 4 </a> </li>
 <li> <a href=""> Menu 5 </a> </li>
 <li> <a href=""> Menu 6 </a> </li>
 <li> <a href="user.php"> User  </a> </li>
 <li> <a href="admin.php"> Admin  </a> </li>
 <li> <a href="login.php"> Login </a> </li>
 <li> <a href="create_username.php"> Create Username </a> </li>
 </ul>
 </div>
 <div id="content"> 

页脚:

</div>
<div id="footer">
This is a Footer.
</div>
</body>
</html>

样式表:(在#container 之前我的样式表中还有一个默认重置)

#container {
width:100%;
height:100%;
}   
#header {
width: 100%;
height:120px;   
}
#column_left {  
float:left;
width:15%;
height:100%;
border-right: 3px solid #06F;
border-left: 3px solid #06F;    
}
#content {
width:100%;
height:100%;
}

#footer {

width:100%;
height: 30px;
border-top:3px solid #06F;
}
#navigation_top {
width:100%;
height:15px;
border-bottom:3PX solid #06F;
}
#toptitle {
padding:30px;
font-size:300%;
font-weight:700;
}
.formtitle {
font-weight:800;
font-size:150%;
}
#form {
margin-left:230px;
padding-top:30px;
}
table,th, td {
border: 1px solid black;
}
table {
width:1024px;
}
th {
font-weight:800;
background-color:#0FF;
}

这是给我这些问题的页面代码!

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php   

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

$date1 = mysql_prep($_POST['date1']);
$date2 = mysql_prep($_POST['date2']);
$latte = mysql_prep($_POST['latte']);
$coffee = mysql_prep($_POST['paid']);

$query = "SELECT * 
          FROM payroll  
          WHERE (day BETWEEN '{$date1}' AND '{$date2}')
          AND (company = '{$latte}')  
          AND (paid = '{$coffee}')  
          ORDER BY day ASC ";

$result = mysql_query($query, $connection);     

$woof = "SELECT SUM(p.hours) AS sum_hours 
 , COUNT(DISTINCT p.day) AS cnt_days 
 FROM PAYROLL p 
 WHERE p.day BETWEEN '{$date1}' AND '{$date2}'  
 AND company = '{$latte}'  
 AND paid = '{$coffee}' ";

$raw = mysql_query($woof, $connection);
if(!$raw) { die(mysql_error());}
$meow = mysql_result($raw, 0, 0);
$days = mysql_result($raw, 0, 1);



if(!$result) {
    echo "FAIL"; 
     } else { 

     $message = "<table>
<tr>
<th> Date </th>
<th> Hours </th>    
<th> Job Title </th>
<th> Job Description </th>
<th> For </th>
<th> Paid </th>
</tr>";

while($row = mysql_fetch_array($result)) {


$company = $row['company']; 

if($company == 0) {
$company = "Wilson Electric";
} if($company == 1) {
    $company = "Wilson Rental";
    } if ($company == 2) {
        $company = "Church of Christ";
        }

$paid = $row['paid'];
    if($paid == 0) {
        $paid = "Yes";
        } else {
            $paid = "<form action=\"update.php\" method=\"post\" ><input type=\"checkbox\" name=\"paid\" value=\"0\"> NO ";
            }


$message .= "<tr>";
$message .=  "<td class=\"center\">" . $row['day'] . "</td>";
$message .=  "<td class=\"center\">" . $row['hours'] . "</td>";
$message .= "<td style=\"padding:5px;\">" . $row['job_title'] . "</td>";
$message .=  "<td style=\"padding:5px;\">" . $row['job_description'] . "</td>";
$message .=  "<td style=\"padding:5px;\">" . $company . "</td>";
$message .=  "<td class=\"center\">" . $paid . "</td>"; 

$message .=  "</tr>";
}
$message .=  "<tr>";
$message .=  "<td class=\"center\"> Total Days:  " . $days . "</td>";
$message .=  "<td class=\"center\"> Total Hours: " . $meow . "</td>";
$message .=  "<td class=\"center\"> &nbsp; </td>";
$message .=  "<td class=\"center\"> &nbsp; </td>";
$message .=  "<td class=\"center\"> &nbsp; </td>";
$message .=  "<td class=\"center\"> <input type=\"submit\" name=\"gamind\" value=\"Update\"> </form> </td>";
$message .=  "</tr>";
}
}


?>  
<?php include("includes/header.php"); ?>
<form action="" method="post" id="form">
<h1 class="formtitle"> Search </h1>
<br />

<table id="table1">
<th> From </th>
<th> To   </th>
<th> For </th>
<th> Paid </th>
<tr>
<td>
<input type="date" name="date1" value="" > 
</td>   
<td>
<input type="date" name="date2" value="" > 
</td>
<td>
<select name="latte" >
<option value="0"> Wilson Electric </option> 
<option value="1"> Wilson Rental </option> 
<option value="2"> Church of Christ</option> 
</select>
</td>
<td>
<input type="radio" name="paid" value="0"> Yes <br />
<input type="radio" name="paid" value="1"> No <br />
</tr>
<tr>
<td colspan="4" align="right"> <input type="submit" name="search" value="Search">
</td>
</tr>
</table>

<br />
<br />
<p>
<?php
    if(!empty($message)) {
        echo "<h1 class=\"formtitle\"> Payroll Result </h1>";
        echo $message;
        }
    ?>
</p>
</form>
<?php include("includes/footer.php"); ?>
    <?php mysql_close($connection); ?>

很抱歉这个loooong帖子!我希望有人知道我的问题的解决方案!

谢谢!:)

4

1 回答 1

0

这里有很多代码需要吸收,但我认为你的 $message 构建了 <tr>s,但是当你回显 $message 时,你不在 table 元素内..?

于 2013-02-21T22:07:11.470 回答