Respecting line breaks?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Respecting line breaks?

    Hi all,

    I'm try to make a forum, in which people can add messages to a
    discussion. I use a textarea for input and store this text in a
    database. When I read the text from the database and display it with PHP
    all the line breaks entered by the sender have disappeared. Can anyone
    tell me how to solve this problem?

    Thanx,
    WJ

    william Guest

  2. Similar Questions and Discussions

    1. Get rid of uselses line breaks?
      Greetings, I noticed when I use design mode on Dreamweaver to input text, I get too many line breaks on the source code. Is there a way to...
    2. cfmail line breaks
      I'm sending text only email via cfmail. I don't seem to have much control over line breaks. Code is: <cfmail ....> (type not specified) Name:...
    3. Excess Line Breaks
      I updated to MX and opened my site up to find it had put in large numbers of empty lines between lines of code... I'm working with .php files and...
    4. Line Breaks (DB APP)
      What server model are you using? ASP? PHP? CF? -- Dave ----------------------------------------------------------------- If I were half as...
    5. How to insert line breaks using SQL
      I would try using a true CR+LF pair, e.g. CHAR(13)+CHAR(10) -- Aaron Bertrand, SQL Server MVP http://www.aspfaq.com/ Please reply in the...
  3. #2

    Default Re: Respecting line breaks?

    Try using the <pre></pre> tags around the outputted text.

    "william" <wjz@wirehub.nl> wrote in message
    news:WdmAc.2800$D67.769@amsnews02.chello.com...
    > Hi all,
    >
    > I'm try to make a forum, in which people can add messages to a
    > discussion. I use a textarea for input and store this text in a
    > database. When I read the text from the database and display it with PHP
    > all the line breaks entered by the sender have disappeared. Can anyone
    > tell me how to solve this problem?
    >
    > Thanx,
    > WJ
    >

    Jonny Guest

  4. #3

    Default Re: Respecting line breaks?

    william wrote:
    > Hi all,
    >
    > I'm try to make a forum, in which people can add messages to a
    > discussion. I use a textarea for input and store this text in a
    > database. When I read the text from the database and display it with PHP
    > all the line breaks entered by the sender have disappeared. Can anyone
    > tell me how to solve this problem?
    >
    > Thanx,
    > WJ
    >
    You need to replace textual line breaks with html line breaks -

    [url]http://uk.php.net/manual/en/function.nl2br.php[/url]

    Regards,

    Andy

    Andy Barfield Guest

  5. #4

    Default Re: Respecting line breaks?

    You have to understand one thing about HTML. Unless the line breaks
    are either a) Placed inside of <pre></pre> tags or b) replaced with
    either <br> or <p>, they are ignored. Similar to how most line breaks,
    and whitespace, is ignored in PHP. Like in some other posts, you could
    simply use nl2br() to convert the line breaks from your user's input
    into <br> tags.

    On Thu, 17 Jun 2004 19:24:38 GMT, william <wjz@wirehub.nl> wrote:
    >Hi all,
    >
    >I'm try to make a forum, in which people can add messages to a
    >discussion. I use a textarea for input and store this text in a
    >database. When I read the text from the database and display it with PHP
    > all the line breaks entered by the sender have disappeared. Can anyone
    >tell me how to solve this problem?
    >
    >Thanx,
    >WJ
    eclipsboi Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139