...

View Full Version : Resolved Table Height Problem



Feckie
08-04-2011, 09:15 AM
Hi

I have the following code, that I can't adjust the table height in..

<?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 % 8 == 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....

http://www.179a.com/table 1.png

bullant
08-04-2011, 09:27 AM
try playing with cellspacing values.

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

Feckie
08-04-2011, 09:50 AM
I have tried cell spacing

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


<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>

bullant
08-04-2011, 11:18 AM
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.

Feckie
08-04-2011, 11:29 AM
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


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

bullant
08-04-2011, 11:38 AM
no problem :)

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


<input type="hidden" name="*Beehive" value="*Beehive">

would generate a validation error because in xhtml input must end with />

Feckie
08-04-2011, 11:43 AM
no problem :)

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


<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

bullant
08-04-2011, 11:50 AM
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.

Feckie
08-04-2011, 12:12 PM
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


This document was successfully checked as XHTML 1.0 Strict!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum