#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171

    PHP printing tabs in retrieved from the database.


    Hello;

    I understand that nl2br returns string with '<br />' or '<br>' inserted before all newlines (\r\n, \n\r, \n and \r).

    What can I do about tabs now?

    How can I print tabs? In other words if I store plain text with some tabs, html removes them all. I need them back.

    Thanks
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,990
    Rep Power
    9397
    Just like with newlines, HTML does not remove them. They're all condensed to a single whitespace.

    Where are you displaying this and why do you need the actual tabs? Would a table be better?
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171
    Originally Posted by requinix
    Just like with newlines, HTML does not remove them. They're all condensed to a single whitespace.

    Where are you displaying this and why do you need the actual tabs? Would a table be better?
    Hi;
    I wanna preview like code.

    I attached a screenshot of what it looks like in phpmy.

    Thanks
    Attached Images
  6. #4
  7. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,101
    Rep Power
    1990
    Wouldn't that normally be done using <pre> tags?
  8. #5
  9. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171
    Originally Posted by Catacaustic
    Wouldn't that normally be done using <pre> tags?
    Worked. Thanks

IMN logo majestic logo threadwatch logo seochat tools logo