我写了一个完美的页面,可以显示我需要的数据。问题是我的页脚显示为我的标题...我不知道为什么。谁能解释一下?我把它放在页面的末尾,在所有的PHP代码之后,在我看来它应该插在那里,但由于某种原因它显示在顶部。
如果有人能提供帮助,我们将不胜感激。
这是页面: http://kaboomlabs.com/testbed/print.php?id=1
以下是代码:
<?php
require_once('tb/connectvars.php');
echo '<div id="printwrap">'
?>
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PDI NCMR - Print</title>
<link rel="stylesheet" type="text/css" href="tb/postie.css" />
</head>
<body>
<div id="logo">
<img src="tb/PDI_Logo_2.1.gif" alt="PDI Logo" />
</div>
<?php
// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
// Grab the profile data from the database
if (!isset($_GET['id'])) {
$query = "SELECT * FROM ncmr WHERE id = '$id'";
}
else {
$query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'";
}
$data = mysqli_query($dbc, $query);
if (mysqli_num_rows($data) == 1) {
// The user row was found so display the user data
$row = mysqli_fetch_array($data);
echo'<div id="title"><h3 id="NCMR2">Non-Conforming Materials Report (NCMR: ' . $row['rma'] . ')</h3></div>';
echo '<form id="all">';
echo '<fieldset>';
//Part, Rev, Part Description, NCMR Qty
echo '<div id="box1p">';
if (empty($row['ab'])) $row['ab'] = "Empty";
if (empty($row['date'])) $row['date'] = "Empty";
if (empty($row['part'])) $row['part'] = "Empty";
if (empty($row['rev'])) $row['rev'] = "Empty";
if (empty($row['partdesc'])) $row['partdesc'] = "Empty";
if (empty($row['ncmrqty'])) $row['ncmrqty'] = "Empty";
echo '<div id="abp"><span class="b">Added By: </span>' . $row['ab'] . '</div>';
echo '<div id="datep"><span class="b">Date Filed: </span>' . $row['date'] . '</div>';
echo '<div id="partp"><span class="b">Part Number: </span>' . $row['part'] . '</div>';
echo '<div id="revp"><span class="b">Part Revision: </span>' . $row['rev'] . '</div>';
echo '<div id="partdescp"><span class="b">Part Description: </span>' . $row['partdesc'] . '</div>';
echo '<div id="ncmrqtyp"><span class="b">NCMR Qty: </span>' . $row['ncmrqty'] . '</div>';
echo '</div>';
//Part, Rev, Part Description, NCMR Qty, JO, SN and INV
echo '<div id="box2p">';
if (empty($row['comp'])) $row['comp'] = "Empty";
if (empty($row['ncmrid'])) $row['ncmrid'] = "Empty";
if (empty($row['rma'])) $row['rma'] = "Empty";
if (!empty($row['NCMR_Qty'])) $row['NCMR_Qty'] = "Empty";
echo '<div id="comp"><span class="b">Company: </span>' . $row['comp'] . '</div>';
echo '<div id="ncmrid"><span class="b">Customer NCMR ID: </span>' . $row['ncmrid'] . '</div>';
echo '<div id="rma"><span class="b">Internal RMA: </span>' . $row['rma'] . '</div>';
echo '<div id="jno"><span class="b">Job #: </span>' . $row['jno'] . '</div>';
echo '</div>';
//Inventory On Hand, Inventory Check, Supplier Name, Supplier Number, Manufacturer Part Number, Manufactuer Serial Number and NCMR ID
echo '<div id="box3p">';
if (empty($row['fdt'])) $row['fdt'] = "Empty";
if (empty($row['cof'])) $row['cof'] = "Empty";
echo '<h2>Failures</h2>';
echo '<div id="fdt"><span class="b">Failure Due To: </span><br />' . $row['fdt'] . '</div>';
echo '<div id="cof"><span class="b">Class of Failure: </span><br />' . $row['cof'] . '</div>';
echo '</div>';
//Nonconformity, Disposition, Comments and Comments & Additional Details
echo '<div id="box4p">';
if (empty($row['fab1'])) $row['fab1'] = "Empty";
if (empty($row['fab2'])) $row['Disposition'] = "Empty";
if (empty($row['fab3'])) $row['Comments'] = "Empty";
echo '<h2>Fabricators</h2>';
echo '<div id="fab1"><span class="b"></span>' . $row['fab1'] . '</div>';
echo '<div id="fab2"><span class="b"></span>' . $row['fab2'] . '</div>';
echo '<div id="fab3"><span class="b"></span>' . $row['fab3'] . '</div>';
echo '</div>';
//PO, PO Date, and Date Recieved
echo '<div id="box5p">';
if (empty($row['non'])) $row['non'] ="Empty";
if (empty($row['dis'])) $row['dis'] ="Empty";
if (empty($row['comm'])) $row['comm'] ="Empty";
if (empty($row['caad'])) $row['caad'] ="Empty";
echo '<div id="non"><span class="b">Nonconformity: <br /></span>' . $row['non'] . '</div><br /><br />';
echo '<div id="dis"><span class="b">Disposition: <br /></span>' . $row['dis'] . '</div><br /><br />';
echo '<div id="comm"><span class="b">Comments: <br /></span>' . $row['comm'] . '</div><br /><br />';
echo '<div id="caad"><span class="b">Comments and/or Additional Details: <br /></span>' . $row['caad'] . '</div>';
//PO, PO Date, and Date Recieved
echo '<div id="podrp">';
if (empty($row['po'])) $row['po'] ="Empty";
if (empty($row['pod'])) $row['pod'] ="Empty";
if (empty($row['dri'])) $row['dri'] ="Empty";
echo '<div id="pop"><span class="b">PO: </span>' . $row['po'] . '</div>';
echo '<div id="podp"><span class="b">PO Date: </span>' . $row['pod'] . '</div>';
echo '<div id="drip"><span class="b">Date Recieved: </span>' . $row['dri'] . '</div>';
echo '</div>';
echo '</div>';
echo '<div id="box6p">';
//NCMR Supplier Response & Comment if not empty
if (empty($row['ncmrsr'])) $row['ncmrsr'] ="Empty";
if (empty($row['ncmrsc'])) $row['ncmrsc'] ="Empty";
echo '<div id="ncmrsr"><span class="b">NCMR Supplier Response:</span><br />' . $row['ncmrsr'] . '</div><br /><br />';
echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:</span><br />' . $row['ncmrsc'] . '</div><br /><br />';
echo '</div>';
echo '</fieldset>';
echo '</div>';
echo '</form>';
}
mysqli_close($dbc);
echo '</div>';
require_once('tb/pfooter.php');
?>
</body>
</html>
答案 0 :(得分:1)
footer
类不是问题,printwrap
ID是。它设置为绝对定位,因此流定位元素(例如页脚的div
)在渲染时会忽略它。由于footer
(及其上方的hr
)是页面上的第一个流定位元素,因此它们会在顶部呈现。
只需在Firebug中进行调整,从#printwrap
中的postie.css
定义中删除以下内容即可:
height: 930px;
position: absolute;
绝对定位和流量定位并不总能很好地协同工作。人们真的需要知道自己在做什么。
答案 1 :(得分:1)
这是因为您的div#printwrap
有一个position: absolute
作为CSS规则。使用这种位置时,元素将从文档流中获取,因此下一个元素(<hr>
和您的页脚)会在不考虑div#printwrap
的情况下开始其流程。取消position: absolute
,一切都会有效。
答案 2 :(得分:0)
从文件/testbed/tb/postie.css
的第110行删除以下代码:
height: 930px;
position: absolute;