Click to See Complete Forum and Search --> : problem writing a table using echo


aatwo
05-27-2007, 06:35 AM
I have written some php that is echo'ing a table however for some reason it won't register the cellpadding value. No matter what value I set it to it ignores it and applies none.

Can anyone see any problems with my code which might be the cause of this?

The page in question can be found here... http://www.aatwo.com/art/
This is my code:


echo "<center><table cellpadding='10' width='600' border='0'>
<tr>
<th>Thumbnail</th>
<th>Image Details</th>

</tr>";
$color = "#AD9B4D";
while($row = mysql_fetch_array($result))
{
echo "<tr bgcolor='" . $color . "'>";
echo "<td align='center'><a href='" . $row['image'] . "'><img border='0' src='" . $row['thumbnail'] . "'></a></td>";
echo "<td align='justify'><b>" . $row['imageName'] . "</b><sub> (Posted " . $row['datePosted'] . ")</sub><br><br>" . $row['imageNotes'] . "<br><br></td>";
echo "</tr>";
if($color=="#AD9B4D")
{
$color="#9C8463";
}else{
$color="#AD9B4D";
}

}
echo "</table></center>";

hastx
05-27-2007, 08:28 AM
I would check the CSS forum. PHP is echoing the cellpadding attribute in the source, but your page renders completely different between IE and Firefox. My first guess after viewing the source is that the padding issue is the result of conflicting styles, deprecated tags, or a combo of the 2.

sanchez_1960
05-31-2007, 06:38 AM
I would highly recommend you use tables outside of php echo. Simply echo each PHP value within <? and ?>