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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.