Results 1 to 3 of 3

Thread: [RESOLVED]TEXT Field

  1. #1

    Thread Starter
    Hyperactive Member samsyl's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    338

    [RESOLVED]TEXT Field

    when i show a text field into area box from table, it comes nicely with formated text but when i try to show in a <td>, its messed up.

    like

    in area box -
    Istiaque Sami
    Ambarkhana
    Sylhet - 3100
    Bangladesh

    in TD

    Istiaque Sami Ambarkhana Sylhet - 3100
    Bangladesh

    why?
    Last edited by samsyl; Oct 11th, 2006 at 03:36 PM.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: TEXT Field

    because line breaks do not show up in HTML pages unless you break the line using the "<BR>" tag. you can simply do this before you put it in the <TD>:
    PHP Code:
      //assuming $data is your information, you can do this:
      
    $data str_replace("\n""<br />"$data);
      
    $data str_replace("\r"""$data);
      
    //now, you can put it in the td
      
    echo "<td>$data</td>\n"
    This will remove line breaks and carriage returns from your data and replace them with one line break in HTML.
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Hyperactive Member samsyl's Avatar
    Join Date
    Jun 2001
    Location
    London
    Posts
    338

    Re: TEXT Field

    Thanks. Its working nicely.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width