Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Posts
    204
    Thanks
    29
    Thanked 0 Times in 0 Posts

    Table Height Problem

    Hi

    I have the following code, that I can't adjust the table height in..
    PHP Code:
    <?php

    // Include database connection
    include("connect.php");
    // SQL query to interact with info from our database
    $sql mysql_query("SELECT DISTINCT `cat_name` FROM `gifts` ORDER BY `cat_name` ASC");
    $i 0;
    // Establish the output variable
    $display_table '<table align="center" border="0" cellpadding="0">';
    while(
    $row mysql_fetch_array($sql)){

    $cat_name=($row['cat_name']);

    //Table Here
        
    if ($i == 0) {
            
    $display_table .= '<tr><td align="center"><form action="Gifts_Search.php" method="post">
    <input type="hidden" name="' 
    $cat_name '" value="' $cat_name '">
    <input type="submit" value="' 
    $cat_name '" />
    </form></td>'
    ;
        } else {
            
    $display_table .= '<td align="center"><form action="Gifts_Search.php" method="post">
    <input type="hidden" name="' 
    $cat_name '" value="' $cat_name '">
    <input type="submit" value="' 
    $cat_name '" />
    </form></td>'
    ;
        }
        
    $i++;
    }
    $display_table .= '</tr></table>';

     echo 
    $display_table;
    ?>
    I want to close the gap between the arrows in the picture.. I have tried <td height="20">, but no good. Anyone help please....

    Last edited by Feckie; 08-04-2011 at 10:30 AM.

  • #2
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    try playing with cellspacing values.

    If that doesn't help, post the actual html the php code generates along with your css.

  • #3
    Regular Coder
    Join Date
    Jan 2009
    Posts
    204
    Thanks
    29
    Thanked 0 Times in 0 Posts
    I have tried cell spacing

    here is the "OUTPUT", I have NO css yet

    Code:
    <table align="center" border="0" cellpadding="0"><tr><td height="20" align="center"><form action="Gifts_Search.php" method="post">
    <input type="hidden" name="*Beehive" value="*Beehive">
    <input type="submit" value="*Beehive" />
    </form></td><tr><td height="20" align="center"><form action="Gifts_Search.php" method="post">
    <input type="hidden" name="*Cellar" value="*Cellar">
    <input type="submit" value="*Cellar" />
    </form></td><tr><td height="20" align="center"><form action="Gifts_Search.php" method="post">
    <input type="hidden" name="*Garage" value="*Garage">
    <input type="submit" value="*Garage" />
    </form></td>
    Last edited by Feckie; 08-04-2011 at 08:54 AM.

  • #4
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    If you put the generated html through the w3c validator, you will see numerous errors and so you should fix those first.

    Also, some browsers have default margins and paddings for some elements. Set all the table element's margins and padding to 0.

  • #5
    Regular Coder
    Join Date
    Jan 2009
    Posts
    204
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bullant View Post
    If you put the generated html through the w3c validator, you will see numerous errors and so you should fix those first.

    Also, some browsers have default margins and paddings for some elements. Set all the table element's margins and padding to 0.
    You won't believe it..... Added the code below to the top off the page and it's fixed...

    Thanks

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  • #6
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    no problem

    You must have fixed the errors in the html as well otherwise at least this line

    Code:
    <input type="hidden" name="*Beehive" value="*Beehive">
    would generate a validation error because in xhtml input must end with />

  • #7
    Regular Coder
    Join Date
    Jan 2009
    Posts
    204
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bullant View Post
    no problem

    You must have fixed the errors in the html as well otherwise at least this line

    Code:
    <input type="hidden" name="*Beehive" value="*Beehive">
    would generate a validation error because in xhtml input must end with />
    No I did nothing else, and the code is the output from the code at the very top

  • #8
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    then all you have done is got the output display to be what you want in the browser you are using.

    But if you run your code through the w3c validator with an xhtml doctype like you posted then any input elements ending with just a > like you have and not an /> as required by xhtml will generate validation errors.

    With invalid (x)html you are increasing the probability of your page not displaying correctly in some browsers.

  • #9
    Regular Coder
    Join Date
    Jan 2009
    Posts
    204
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bullant View Post
    then all you have done is got the output display to be what you want in the browser you are using.

    But if you run your code through the w3c validator with an xhtml doctype like you posted then any input elements ending with just a > like you have and not an /> as required by xhtml will generate validation errors.

    With invalid (x)html you are increasing the probability of your page not displaying correctly in some browsers.
    OK now sorted

    Code:
    This document was successfully checked as XHTML 1.0 Strict!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •