PDA

View Full Version : NEED HELP!!! PHP include content displays always shifted down, WHY?



jimdasaint
February 10th, 2008, 03:27 PM
Hi,
I am fairly new to using PHP and Dreamweaver together and I have placed the included code in my document and I have noticed that the PHP generated table, div or anything else is always shifting down in IE and FireFox as well. Why?...and what is the solution to display and position
dynamic content correctly inside the "content" div without unexpected shifting and having control of it. In this scenario I just want the table to start at the top as if I would type something in a div instead of displaying it much lower.
Thank you in advance.
jim

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<title>Welcome to the library!</title><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
background-color: #CCD3D9;
color: #000000;
text-align: center;
}
#content {
width: 800px;
height: 1000px;
margin-left: auto;
margin-right: auto;
border: 2px solid #A6B2BC;
background-color: #FFFFFF;
color: #000000;
margins: 0 20px 0 20px;
text-align: left;
}
#TableResult {
width: 750px;
height: 900px;
margin-left: auto;
margin-right: auto;
background-color: #FFFFFF;
color: #000000;
text-align: left;
border-collapse:collapse;
}
#TableResult td {
padding: 0.7em 0.5em 0.5em 0.8em;
border: 2px solid #A6B2BC;
background-color: #CCFFCC;
}
</style>
</head>
<body>
<div id="content">
<?
include("library_browse.php");
?>
</div>
</body>

<!-- the code below is the PHP content in "library_browse.php"-->

<?include("database.php");
$result = mysql_query("SELECT * FROM library");
print ("<TABLE id=\"TableResult\">");
print ("<TR><TD colspan=\"7\" >Available Books</TD></TR><BR>");
print ("<TR> <TD> ID </TD> <TD > Title </TD> <TD > Author </TD> <TD > Year </TD> <TD > Delete </TD></TD>");
print ("<TR><TD colspan=\"7\" >Please click the title for more information.</TD></TR><BR>");
while($row = mysql_fetch_array($result)) {
print (" <TR><TD >$row[id] </TD> <TD ><A href=\"browseb.php?id=$row[id]\">$row[title] </A></TD> <TD >$row[author] </TD> <TD >$row[year] </TD><TD ><A href=\"delete.php?id=$row[id]\">Delete </A></TD></TR><BR>");
}
print ("</TABLE>");
mysql_close($linkID);?>

DarkAz
February 11th, 2008, 05:39 AM
Hi,
...I have placed the included code in my document and I have noticed that the PHP generated table, div or anything else is always shifting down in IE and FireFox as well.

everything appears ok at first glance - have you viewed the source of the resulting html page to ensure that nothing extra is being echoed out to the browser?


<!-- the code below is the PHP content in "library_browse.php"-->

Is this the only code included within "library_browser.php"? or is there other (potentially html or plain text) in there?

Check for unwanted whitespace also (may not be - but hard to tell).

AuroraMedia
February 11th, 2008, 06:03 AM
please check the line

print ("<TR> <TD> ID </TD> <TD > Title </TD> <TD > Author </TD> <TD > Year </TD> <TD > Delete </TD></TD>");

Their are two </TD> tags in the end. The last should be </TR>

This could possible be causing your problem.

Also, I don't see why you wish to use the break tag after line and in any case if you use then you should use it as <br/> and not as <br> since you are declaring the document as XHTML