Web Hosting Talk







View Full Version : HTML/PHP Textarea Problem.


Tomer
11-16-2004, 04:05 PM
Hello,

I have a problem with some HTML/PHP forms [textarea].

I have a textarea, and lets say you write this in the textarea.

-----------
Hello,

1, 2, 3

4, 5, 6.
-----------

After sending it, the form variable [$_POST] will contain:

-----------
Hello, 1, 2, 3 4, 5, 6.
-----------

How do I get it to count the line breaks?

Thanks

SPaReK
11-16-2004, 04:41 PM
How are you looking at the contents of the POST data? Are you looking at it from a website or from the source? The source should contain the carriage return characters, however HTML does not recognize carriage returns as new lines, instead you have to use <br> tags. You can try using the PHP function nl2br() to convert newlines into HTML readable <br> tags.

Tomer
11-17-2004, 09:39 AM
Thanks, that was the function I was looking for.