hi,
I am creating code for registration form with description field and then i am trying to display all vales using table fields i gave td width as 50 wen i am displaying description if its having huge content its not taking limit its gets expanded but i want like this that huge content gets adjusted within the td i dont want expand it can anyone help about this

thanks in advance
Punitha pary

Are you saying that you would like the data in a <TD> tag not to expand when you enter a lot of data into them?

if so you might want to try <td style="overflow: scroll;">?

You can also try to limit the content of the description.

eg:

<td><?php echo substr(0,100,$desc)."...";

This will show only first 100 characters of the description.

//try out this function

function limit_words($text, $limit) {
    $text = strip_tags($text);
      $words = str_word_count($text, 2);
      $pos = array_keys($words);
      if (count($words) > $limit) {
          $text = substr($text, 0, $pos[$limit]) . ' ...';
      }
    return $text;
    }



//in html while display description 

<td align="left"> 
<? 
$text = strip_tags($row["description"]);// data from database field description

 if (strlen($text) <= 150) 
{
   echo $text;
}
else
{
  echo limit_words($text, 150,50);  //here set limit as much as u want
}
?>
</td>

Hi,
I tried this but its showing limited charaters only but i want to show all text with in the td that means hole text will display in td with i the width.i dont want any scroll bar in down.

You can also try to limit the content of the description.

eg:

<td><?php echo substr(0,100,$desc)."...";

This will show only first 100 characters of the description.

Well then I'd say either set the width of the TD ( <td style="width: 123px;">text</td> ) or use the overflow property ( <td style="overflow: scroll;">text</td> )

This article has been dead for over six months. Start a new discussion instead.