searls03 Posted April 28, 2011 Share Posted April 28, 2011 ok, so I have this code and it is always making the last cell move down if I add line breaks after the </div> (wrapper) tag. Why does it do this? does this make sense? if not let me know......(this is hard to describe!) <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; $userid = $row["userid"]; } ?> <?php include 'config.php'; include 'opendb.php'; // if no id is specified, list the available articles if(!isset($_GET['id'])) { $query = "SELECT * FROM messages WHERE recipient ='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($from1, $recipient, $title1, $content, $id, $date, $read) = $row; if ($read == "1"){ $content1 .= "<table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr><td valign='top' width='274'> $from1</td> <td valign='top' border='1' width='1025'><a href='/message.php?id=$id'>$title1</a></td></tr><br /> "; }else{ $content1 .= "<table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td width='274'><strong>$from1</strong></td><td width='1025'> <a href=/message.php?id=$id>$title1</a></td></tr><br /> "; }} }else { // get the article info from database $query = "SELECT * FROM messages WHERE recipient='$name' ORDER by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $title = $row['title']; $content = $row['content']; $to = $row['recipient']; $from = $row['from1']; $id = $row['id']; $read = $row['read']; } // if no id is specified, list the available articles if(!isset($_GET['id'])) { $self = $_SERVER['PHP_SELF']; $query = "SELECT * FROM comments WHERE recipient='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($com_id, $userid, $id1, $id, $recipient, $comment, $sender, $title, $date, $read) = $row; if ($read == "1"){ $content1 .= "<table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr><td valign='top' width='274'>$sender</td> <td valign='top' width='1025'> <a href='/reply.php?com_id=$com_id'>$title</a></td></tr><br /> "; }else { $content1 .= "<table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td valign='top' width='274'><strong>$sender</strong></td> <td valign='top' width='1025'><a href='read1.php?com_id=$com_id'>$title</a> </form></td></tr><br /> "; echo "</table>"; } } } else { // get the article info from database $query = "SELECT * FROM comments WHERE recipient='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $userid = $row['userid']; $id1 = $row['id1']; $id = $row['messageid']; $recipient = $row['recipient']; $comment = $row['comment']; $sender = $row['sender']; $title = $row['title']; $read = $row['read']; } include 'closedb.php'; ?> <!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"><!-- InstanceBegin template="/Templates/template2.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Untitled Document</title> <!-- InstanceEndEditable --> <style type="text/css"> body { background-image: url(button/boyscout1.png); background-repeat: no-repeat; position: relative; } #menu { position:relative; left:160px; top:0px; width:931px; height:59px; z-index:19; } #menu #MenuBar1 li a { color: #000; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; width: 100px; } #status { position:relative; left:16px; top:180px; width:124px; height:44px; z-index:14; } </style> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } </script> <!-- InstanceBeginEditable name="head" --> <style type="text/css"> #editregion { position:absolute; left:-8px; top:272px; width:1293px; height:auto; z-index:500; text-align: center; clear: none; float: none; font-family: "Times New Roman sans-serif"; } body { background-image: url(button/boyscout1.png); background-repeat: no-repeat; position: relative; } #menu { position:relative; left:160px; top:0px; width:931px; height:59px; z-index:19; } #menu #MenuBar1 li a { color: #000; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; width: 100px; } #status { position:relative; left:16px; top:180px; width:124px; height:44px; z-index:14; } </style> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } </script> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } </script> <style type="text/css"> #apDiv1 { position:relative; left:11px; top:0px; width:1200px; height:auto; z-index:400; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; } #apDiv2 { position:relative; left:0px; top:33px; width:600; height:auto; z-index:400;} #editregion #apDiv1 table tr th { text-align: left; ; font-family: "Times New Roman sans-serif"; } #editregion #apDiv1 table tr td { text-align: left; } #editregion #apDiv1 table tr td { font-weight: normal; font-size: 1em; font-family: 'Georgia','Verdana','Arial','sans-serif'; } input.link { font-family: 'Georgia','Verdana','Arial','sans-serif'; font-size: 1em; text-align: left; font-weight:bold; color:#91282C; background: none; margin: 0; padding: 0; border: none; cursor: pointer; top:auto; border-top:none; margin-bottom:0; -moz-user-select: text; } input.link1 { font-family: 'Georgia','Verdana','Arial','sans-serif'; font-size: 1em; text-align: left; font-weight:normal; color:#black; background: none; margin: 0; padding: 0; border: none; top:auto; cursor:text; border-top:none; margin-bottom:0; -moz-user-select: text; } input.link1 span { text-decoration:none; } input.link2 { font-family: 'Georgia','Verdana','Arial','sans-serif'; font-size: 1em; text-align: left; font-weight:bold; color:#black; background: none; margin: 0; padding: 0; border: none; top:auto; cursor:text; border-top:none; margin-bottom:0; -moz-user-select: text; } input.link2 span { text-decoration:none;} input.link span { text-decoration: underline; } input.link:hover { color:black; } input.link:focus span { color: brown; } body { font-family: "Times New Roman" sans-serif; } a:link, a:visited { color: blue; } hover { color: black; } a:focus, a:active { color: blue; } </style> <style type="text/css"> body,td,th { font-family: "Times New Roman sans-serif"; } </style> <style type="text/css"> hover { color: #F00; } #editregion #apDiv1 table tr td { font-size: 1em; } #editregion #apDiv1 table tr td strong { font-family: Georgia, Verdana, Arial, Sans-Serif; font-size: 14px; font-weight: bold; } #editregion #apDiv1 #1 tr td { font-family: Georgia, Verdana, Arial, Sans-Serif; font-size: 1em; } #editregion #apDiv1 #table { position:relative; } #editregion #apDiv2 #apDiv1 #1 tr td { text-align: left; } </style> <style type="text/css"> #apDiv3 { position:absolute; left:22px; top:-33px; width:177px; height:23px; z-index:501; } #editregion #apDiv3 { text-align: left; } #editregion #apDiv2 #apDiv1 { text-align: left; } </style> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #logout { position:relative; left:0px; top:0pxpx; width:134px; height:38px; z-index:20; font-weight: bold; font-size: 24px; } #logout a { color: #000; } #status { text-align: center; } #logout1 { position:absolute; left:1071px; top:191px; width:224px; height:61px; z-index:2; } #menu2 { position:absolute; left:-1px; top:172px; width:497px; height:92px; z-index:20; } #footer { position:fixed; left:-10px; width:1290px; height:63px; z-index:500; color: #000; background-color: #000; right: 0px; bottom: 0px; } </style> <!-- InstanceEndEditable --> <!-- InstanceParam name="id" type="text" value="apDiv6" --> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #logout { position:relative; left:0px; top:0pxpx; width:134px; height:38px; z-index:20; font-weight: bold; font-size: 24px; } #logout a { color: #000; } #status { text-align: center; } #logout1 { position:absolute; left:1071px; top:191px; width:224px; height:61px; z-index:2; } #menu2 { position:absolute; left:-1px; top:172px; width:497px; height:92px; z-index:20; } * { padding: 0; } html, body { height: 100%; } .wrapper { min-height: 75%; height: auto !important; height: 75%; padding: 0 auto -1em; } .footer, .push { height: 1em; clear: both; } </style> </head> <body> <div id="menu2"><div id="menu"> <ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="myprofile.php">My Profile</a> </li> <li><a href="register.php">Register</a></li> <li><a href="dashboard.php">Dashboard</a> </li> <li><a href="news.php">News</a></li> <?php if ($accounttype == "Admin") { ?> <li><a href="membermanager.php">Scout Manager</a></li> <li><a href="eventmanager.php">Event Manager</a></li> <li><a href="newsmanager.php">News Manager</a></li> </ul><?php } ?> </div></div> <div id="logout1"><div id="logout"><a href="logout.php">Logout</a></div></div> <div id="status"><?php echo "$accounttype"; ?> <br /><?php echo "$name"; ?> <p> </p> </div><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /> <br /> <div class="wrapper"><!-- InstanceBeginEditable name="EditRegion3" --> <div id="apDiv3"><?php if ($accounttype == "Admin") { echo "<form action=\"/newmess.php?mod=post#\" method=\"post\"><input name=\"submit\" type=\"submit\" value=\"Compose new message!\" /></form>";} ?><?php if ($accounttype == "Scout Master") { echo "<form action=\"newmess.php?mod=post#\" method=\"post\"><input name=\"submit\" type=\"button\" value=\"Compose new message!\" /></form>";} ?></div> <div id="apDiv1"> <table width="1200" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1270" height="27" bgcolor="#C5C0B7" scope="col"><strong><strong>Message Board</strong></strong></td> </tr> </table> <table id='1' width="1200" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="246" scope="col"><br /> Sender</th> <th width="954" scope="col">Subject</th> </tr> <tr> <td align="left" valign="top" scope="col"> </td> <td align="left" valign="top" scope="col"></td> </tr> </table><?php echo $content1; ?> </div> <!-- InstanceEndEditable --> <div class="push"></div></div> <div class="footer"><?php if($accounttype == "Admin"){include_once "footer-ad.php";}else if($accounttype == "Scout Master"){ include_once "footer-ad.php";} else { include_once "footer-sc.php"; } ?> </div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"}); </script> </body> <!-- InstanceEnd --></html> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted April 28, 2011 Share Posted April 28, 2011 This isn't a PHP question. Moving to HTML. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 sorry, I had forgotten to post code first. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 This isn't a PHP question. Moving to HTML. And I do believe this is more of a php/html question, not just html. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted April 28, 2011 Share Posted April 28, 2011 PHP doesn't affect layout. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 ok, I was thinking it was some php cause of how the table layout is actually in php tags, which is what I am guessing is messing it up, but I don't know. Do you have any suggestions? Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 28, 2011 Share Posted April 28, 2011 Do you have this somewhere online? problem is the code above is kinda huge and besides that server side. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 i will send you a pm with login credentials that you can use. Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 28, 2011 Share Posted April 28, 2011 i will send you a pm with login credentials that you can use. okidoki! css and html are always easier to solve once we have a visual reference in the browser Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 28, 2011 Share Posted April 28, 2011 I don't believe the code you provided above creates the result of your website. unless footer-sc.php or footer-ad.php is containing this last table. But just for my interest, is there a reason why your using separate tables and not just 1, and why your not trying to use an external stylesheet. This whole page is one big code bonanza. What i would do is create a new file and take the logic that fetches the data that will fill those tables and try to get that working first before implementing. Right now you problem is far from isolated, making it even harder for us to solve it. (it's 600+ lines) so very simple fetch data and put that in 1 table. ones you can do that it should be easy to implement. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 what it is, this comes from a template made in dreamweaver.......that why it so long..............and the footer-sc/ad is just a picture inside of a php file. I know it is something in this code because the table/div is supposed to end before the footer begins. there is more than one table because there are four different possibility of places for it to go, either to message.php, reply.php, read.php, or read1.php.......So they need to be in more than one table or they never worked. Quote Link to comment Share on other sites More sharing options...
searls03 Posted April 28, 2011 Author Share Posted April 28, 2011 and the page source makes it look like its fine: <table id='1' width="1200" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="246" scope="col"><br /> Sender</th> <th width="954" scope="col">Subject</th> </tr> <tr> <td align="left" valign="top" scope="col"> </td> <td align="left" valign="top" scope="col"></td> </tr> </table><table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td width='274'><strong>Aaron Searls</strong></td><td width='1025'> <a href=/message.php?id=61>test</a></td></tr><br /> <table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td width='274'><strong>Aaron Searls</strong></td><td width='1025'> <a href=/message.php?id=60>test</a></td></tr><br /> <table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td width='274'><strong>Aaron Searls</strong></td><td width='1025'> <a href=/message.php?id=59>test</a></td></tr><br /> <table border='0' cellpadding='0' cellspacing='0' width='1200'> <tr bgcolor='#CCCC99'><td width='274'><strong>Aaron Searls</strong></td><td width='1025'> <a href=/message.php?id=58>test</a></td></tr><br /> </div> <br /><br /> <!-- InstanceEndEditable --> <div class="push"></div></div> <div class="footer"> <div id="1"><img src="footer_scout.png" width="1290" height="63" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="525,5,630,31" href="myprofile.php" /> <area shape="rect" coords="672,6,753,32" href="register.php" /> <area shape="rect" coords="793,6,845,33" href="news.php" /> </map> </div> </div> Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 28, 2011 Share Posted April 28, 2011 sorry mate i stick to what i said, isolate the problem. make it work (isolated) you already wrote the logic so it should be much easier for you than us to fix this. (connect to database fetch results, run foreach loop and create the table rows on the fly. (and that is html) Quote Link to comment Share on other sites More sharing options...
DavidAM Posted April 28, 2011 Share Posted April 28, 2011 I'm guessing that is not the full HTML, but 1) You are starting a new TABLE for each row, but you never close out any of them. I count 4 tables being started and never ended. 2) You have a break <BR /> outside of a row </TR>, so it is NOT in a cell, it is not valid markup, and is probably screwing up the layout. 3) This code snippet is also closing 2 DIVs that were never openned. Clean up the process that generates the main table. If you are still having problems. Request the page in your browser, use the View Source command, copy and paste the HTML here, along with a description of the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.