breaststroke
Programmer
Hello,
I have an everlasting problem with my textareas.
I have a textarea input which inserts a text in my database.
This is okay.
The problem/s comes when I take that text out of the database and print it on the screen.
If I use the nl2br() function, I manage to "print" or respect the newlines of my text.
If I use wordwrap function, I manage to break long words into smaller ones.
Then there wouldn't be any problem.
But these functions are not enough to "respect" or consider any space (/r/s); for example, longer-than usual spaces between words, text-indent at the beginning of the sentence, etc..
So, I have tried using :<pre>$text</pre>;and it works and respects those spaces.
Then, the idea is to apply these three functions (or just the last two).
The problem comes when there are very long words. Now wordwrap does its job again and divide the long words into smaller ones, but there is no "newline" when it should be in order for the text to fit into the div dimensions, even though the div has "width" already set.
So, for example, if I had a 50px wide div, the result applying <pre></pre> could be:
"asd alsdj asñdlk asñdkasdñapwoe asñdlka dñkasd asñkd ásñld...",
so it would respect the wordwrap function, but it wouldn't shorten the long lines. (something that did happen without <pre></pre>).
I hope I have managed to explain my problem more or less. Sorry for my English.
I would appreciate any help.Thank you very much in advance.
Regards
I have an everlasting problem with my textareas.
I have a textarea input which inserts a text in my database.
This is okay.
The problem/s comes when I take that text out of the database and print it on the screen.
If I use the nl2br() function, I manage to "print" or respect the newlines of my text.
If I use wordwrap function, I manage to break long words into smaller ones.
Then there wouldn't be any problem.
But these functions are not enough to "respect" or consider any space (/r/s); for example, longer-than usual spaces between words, text-indent at the beginning of the sentence, etc..
So, I have tried using :<pre>$text</pre>;and it works and respects those spaces.
Then, the idea is to apply these three functions (or just the last two).
The problem comes when there are very long words. Now wordwrap does its job again and divide the long words into smaller ones, but there is no "newline" when it should be in order for the text to fit into the div dimensions, even though the div has "width" already set.
So, for example, if I had a 50px wide div, the result applying <pre></pre> could be:
"asd alsdj asñdlk asñdkasdñapwoe asñdlka dñkasd asñkd ásñld...",
so it would respect the wordwrap function, but it wouldn't shorten the long lines. (something that did happen without <pre></pre>).
I hope I have managed to explain my problem more or less. Sorry for my English.
I would appreciate any help.Thank you very much in advance.
Regards