Jump to content

Box Becoming To Wide


dual_alliance

Recommended Posts

I have a guest book script (very simple) that l have made and modified to work with usernames.  However in the testing stage l posted some junk to see what would happen and it went all the way across the page and kept on going.

My code is as follows:

[code=php:0]// Define $color=1
$color=1;
echo '<table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">';

while($rows=mysql_fetch_array($result)){

// If $color==1 table row color = #FFFFCC + #CCFFFF
if($color==1){

echo "
<td>
<tr>
<table align='center' width='800' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
<tr>
<td width='150' valign='top' bgcolor='#CCFFFF'><font size='-1'>
<strong>Posted By:</strong>".$rows['username']."<br />
<strong>Date: </strong>".$rows['datetime']."<br /></font></td>

<td valign='top' width='650' bgcolor='#FFFFCC'>".$rows['comment']."</td>
</tr>
<br />
</table></td>
</tr>";

//<td width='10' valign='top' bgcolor='#CCFFFF'><a href='deletepost.php?postid=".$rows['userid']."'>X</a></td>
// Set $color==2, for switching to other color
$color=2;
}

// When $color not equal 1, use this table row color #FFFF99 + #CCFFFF
else {
echo "
<td>
<tr>
<table align='center' width='800' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>
<tr>
<td width='150' valign='top' bgcolor='#CCFFFF'><font size='-1'>
<strong>Posted By:</strong>".$rows['username']."<br />
<strong>Date: </strong>".$rows['datetime']."<br /></font></td>

<td valign='top' width='650' bgcolor='#FFFF99'>".$rows['comment']."</td>
</tr>
<br />
</table>
</td>
</tr>
";

// Set $color back to 1
$color="1";
}
}

echo '
</table>';
mysql_close(); //close database
echo "<br />";[/code]

To help you visualize the problem a link to a screen shot is below:

[url=http://img350.imageshack.us/img350/4964/problem1qk4.jpg]http://img350.imageshack.us/img350/4964/problem1qk4.jpg[/url]

Also for some reason the blue box gets smaller on this reply when it should be 150px in width..

Your help is greatly appreciated,

dual_alliance
Link to comment
https://forums.phpfreaks.com/topic/16959-box-becoming-to-wide/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.