PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 307,102 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,021 people online right now. Registration is fast and FREE... Join Now!




Whitespace added with table tag

 

Whitespace added with table tag, Has php as well on page

nashsclay

4 Nov, 2009 - 06:48 PM
Post #1

New D.I.C Head
*

Joined: 31 Jan, 2009
Posts: 46

Hey all. Whenever I add the table tag, a huge white space is added. I looked on Dreamweaver and about 20 </br> tags get added. But when I look at the code in a regular editor, there are no <br> tags to make the space.
Here is the website The White Space Web Page
Here is the code. I posted in this category since there is php in this code.
CODE
<!--
File        : vegetable.php
Description : Vegetable List
-->
<?php
require_once("config.inc.php");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo "$site_name - Vegetable List"; ?></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?php include("header.inc.php"); ?>
<!-- start page -->
    <div id="page">
        <div id="page-bgtop">
            <div id="page-bgbtm">
                <!-- start content -->
                <div id="content">
                    <div class="post">
                        <h1 class="title"><center>Vegetable List</center></h1>
                        <div class="entry">
<center><table>
<tr>
<td>Type of Vegetable</td>
<td>Expected Planting Date</td>
<td>Expected Harvest Date</td>
<td>ft<sup>2</sup> per row</td>
<td>ft<sup>2</sup> per plant</td>
<td>Planting</td>
</tr>
            <?php
            $cxn = mysql_connect($datahost, $datauser, $datapass, $dataname) or die ("Could not connect to server");
            mysql_select_db(perproduce, $cxn);
            $vegtab = "veg";
            $sql = ("SELECT * FROM $vegtab ORDER BY id");
            $res = mysql_query($sql);
            
                $i = 0;
                while ($row=mysql_fetch_array($res))
                {
                    $i++;
                    $cssalt = ($i%2 ? "" : "alt");
                    ?>
                       <tr <?php echo $cssalt; ?>>
                       <td><b><center><h3><?php echo $row['Vegies']; ?></h3></center></b></td>
                       <td><b><center><h3><?php echo $row['plantdate']; ?></h3></center></b></td>
               <td><b><center><h3><?php echo $row['harvestdate']; ?></h3></center></b></td>
               <td><b><center><h3><?php echo $row['sqftrow']; ?></h3></center></b></td>
               <td><b><center><h3><?php echo $row['sqftplant']; ?></h3></center></b></td>    
               <td><center><?php echo $row['Planting']; ?></center></td><br><br>
               </tr>

        <?php
                }
                ?>
        </table></center></div>
                    </div>
                </div>
                <!-- end content -->
                <!-- start sidebar -->
                <?php include("sidebar.inc.php"); ?>
                <!-- end sidebar -->
                <div style="clear:both">&nbsp;</div>
            </div>
        </div>
    </div>
<?php include("footer.inc.php");
?>
</body>
</html>



User is offlineProfile CardPM
+Quote Post


jaql

RE: Whitespace Added With Table Tag

5 Nov, 2009 - 04:58 AM
Post #2

D.I.C Head
**

Joined: 19 Oct, 2009
Posts: 59



Thanked: 5 times
My Contributions
It looks like it's formatted exactly like you have it set up...
User is offlineProfile CardPM
+Quote Post

nashsclay

RE: Whitespace Added With Table Tag

5 Nov, 2009 - 07:00 AM
Post #3

New D.I.C Head
*

Joined: 31 Jan, 2009
Posts: 46

So, what does that mean? If you look at the code in Liveview on CS4, I saw a ton of <br> tags. Jaql, can you be more specific?
User is offlineProfile CardPM
+Quote Post

RPGonzo

RE: Whitespace Added With Table Tag

5 Nov, 2009 - 08:13 AM
Post #4

// Note to self: hmphh .... I forgot
Group Icon

Joined: 16 Mar, 2009
Posts: 771



Thanked: 92 times
Dream Kudos: 25
My Contributions
Its your formatting .. you have this

CODE

<tr <?php echo $cssalt; ?>>


which produces "alt" every now and than ... is this supposed to be a class?? id?? tables are VERY particular and unforgiving on type errors ... all your <br> that you are adding in the code are being placed BEFORE the table because it thinks its outside the table elements ...

i would start by changing

CODE

<tr <?php echo $cssalt; ?>>


to

CODE

<tr>


to make sure that's where it is not spawning from
User is offlineProfile CardPM
+Quote Post

nashsclay

RE: Whitespace Added With Table Tag

6 Nov, 2009 - 09:16 AM
Post #5

New D.I.C Head
*

Joined: 31 Jan, 2009
Posts: 46

I changed it like you said and still same problem.
User is offlineProfile CardPM
+Quote Post

nashsclay

RE: Whitespace Added With Table Tag

9 Nov, 2009 - 10:37 PM
Post #6

New D.I.C Head
*

Joined: 31 Jan, 2009
Posts: 46

We found a solution! or a temp one!
<style type="text/css">.nobrtable br { display: none }</style>
<div class="nobrtable">
That needed to be added before the <table> tag. I know this isn't normal so can someone explain what happened?
Thanks sorry for the double post.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 12:22PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month