hey everyone hope everythings going well......I just started with php and have been teaching myself....and have now run into a roadblock....heres the problem im creating a product review page and so i have my display tables set to 500px in width....then in the td tags i have the code...<?php echo $row["review"];?>.....now when i view it in my browser the data displayed in the tables is not word wrapping so the tables expand to fit the data so i end up with 2000px tables and i mean i have fixed widths but its ignoring that.....is there any way at all to fix that? here is my table code below....

<table width="500" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><?php echo $row["make"]." ".$row["model"];?></td>
</tr>
<tr>
<td width="152"><?php echo $row["poster"]."<br>".$row["Date"];?></td>
<td width="348"> <?php echo $cmt ?></td>
</tr>
</table>

any help would be greatly appreciated thanks.

    The only two reasons I can think of why the table would expand horizontally would be that either (1) there is no white-space in the data, and therefore no place for the browser to insert a line-break, or (2) there is something in the style settings for the document defining the TD elements to be non-wrapping. If the former, you can either use the PHP [man]wordwrap/man function with the optional 4th argument set to true in order to insert line breaks, or else wrap the text within a HTML block-level element (P or DIV, for example) styled to have a fixed width with "overflow: auto" to add a horizontal scrollbar if needed.

      hey thanks i tried the php wordwrap function and it worked great thanks for all the help...

        Write a Reply...