Re: [PHP] textarea new line to mysql database

2009-05-15 Thread tedd
At 2:10 PM -0400 5/15/09, Tom Worster wrote: On 5/15/09 10:12 AM, "Stuart" wrote: What's your problem with using nl2br? it's not multibyte safe. if you're using mb strings, e.g. for utf8 pages and forms, then use preg_replace (with the u modifier) instead of ml2br Whoa -- and I thought yo

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Tom Worster
On 5/15/09 10:12 AM, "Stuart" wrote: > What's your problem with using nl2br? it's not multibyte safe. if you're using mb strings, e.g. for utf8 pages and forms, then use preg_replace (with the u modifier) instead of ml2br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visi

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Michael A. Peters
tedd wrote: Also, one can generate validation errors using "" because there are three different varieties of the tag, namely "", "", and "" -- all of which can be used in different settings. I don't remember which doctypes go with which version (xhtml requires />), but I've run into that pr

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread tedd
At 11:19 AM -0400 5/15/09, Robert Cummings wrote: On Fri, 2009-05-15 at 10:54 -0400, tedd wrote: > 4. Or, listen to me (who is somewhere between Rob/Stuart and Sterex) and use either the tag or the nlbr() function depending upon what you want to do with the output. Both solutions [1 and 2] p

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Michael A. Peters
PHPScriptor wrote: Hello, How do you guys handle this "problem". Just a form with a textarea. When I use enters in the textarea it's saved to the db like this: database: "first line second line" when I edit the value in the form: "first line second line" when I output the value to html: "fir

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread tedd
At 11:29 AM -0400 5/15/09, Paul M Foster wrote: On Fri, May 15, 2009 at 07:19:24AM -0700, PHPScriptor wrote: Mja, that's not my intention, in that case I also could use nl2br... Why does this problem exists? And why does it work with ? Is this a PHP problem or more a HTML problem? HTML d

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread tedd
At 8:38 PM +0530 5/15/09, Manoj Sterex wrote: @tedd: Its just another way of looking at the things. Putting HTML into the DB is not really wrong (perhaps in this context it is). If you do have HTML in the DB, you can directly echo it out and use CSS to style it accordingly. Just my 2 cents. :)

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Robert Cummings
On Fri, 2009-05-15 at 11:29 -0400, Paul M Foster wrote: > On Fri, May 15, 2009 at 07:19:24AM -0700, PHPScriptor wrote: > > > > > Mja, that's not my intention, in that case I also could use nl2br... > > > > Why does this problem exists? And why does it work with ? Is this a PHP > > problem or mor

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Paul M Foster
On Fri, May 15, 2009 at 07:19:24AM -0700, PHPScriptor wrote: > > Mja, that's not my intention, in that case I also could use nl2br... > > Why does this problem exists? And why does it work with ? Is this a PHP > problem or more a HTML problem? HTML doesn't recognize newlines when it displays te

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Robert Cummings
On Fri, 2009-05-15 at 10:54 -0400, tedd wrote: > At 7:22 AM -0700 5/15/09, PHPScriptor wrote: > >Well, the problem is that I have a lot of forms, a lot of data to output, and > >even then, I don't know always where I have a textarea or just a inputfield. > >But true, I could even set the nl2br on a

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Manoj Sterex
@tedd: Its just another way of looking at the things. Putting HTML into the DB is not really wrong (perhaps in this context it is). If you do have HTML in the DB, you can directly echo it out and use CSS to style it accordingly. Just my 2 cents. :) -Sterex On Fri, May 15, 2009 at 8:24 PM, tedd

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread tedd
At 7:22 AM -0700 5/15/09, PHPScriptor wrote: Well, the problem is that I have a lot of forms, a lot of data to output, and even then, I don't know always where I have a textarea or just a inputfield. But true, I could even set the nl2br on an input field, it wouldn't make a difference. But I just

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Stuart
2009/5/15 PHPScriptor : > > Well, the problem is that I have a lot of forms, a lot of data to output, and > even then, I don't know always where I have a textarea or just a inputfield. > But true, I could even set the nl2br on an input field, it wouldn't make a > difference. > But I just don't unde

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Manoj Sterex
TinyMCE: http://tinymce.moxiecode.com/ -Sterex On Fri, May 15, 2009 at 7:56 PM, Paul M Foster wrote: > On Fri, May 15, 2009 at 07:03:49AM -0700, PHPScriptor wrote: > > > > > Hello, > > > > How do you guys handle this "problem". > > > > Just a form with a textarea. When I use enters in the textar

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Manoj Sterex
@Robert: True. I was assuming that the text was going to be final and not being edited again. @PHPScriptor: If you do have a lot of textareas to work around with, why don't you give TinyMCE a try. Thats the best option you have got. It replaces the textarea into more of a html compatible one and w

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Manoj Sterex
Well, its not exactly a 'problem' at all. The textarea just does what its meant to do - accept raw text input and lets you process it via form action. This is neither a PHP or a HTML 'problem'. The reason you cannot see the line breaks when you echo the text on your browser is the fact that the br

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Paul M Foster
On Fri, May 15, 2009 at 07:03:49AM -0700, PHPScriptor wrote: > > Hello, > > How do you guys handle this "problem". > > Just a form with a textarea. When I use enters in the textarea it's saved to > the db like this: > > database: > "first line > second line" > > when I edit the value in the f

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Robert Cummings
On Fri, 2009-05-15 at 19:48 +0530, Manoj Sterex wrote: > Well, instead of storing the text from the textarea directly into the db, > validate it and wrap it with tags (replace \n) and then store it. > This way you needn't use nl2br every time you retrieve the text from db. Don't do that unless it

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread PHPScriptor
Yes, I thought about that. But then you have a problem when you're going to 'edit' that data back in a form. Then you get "first linesecond line" in your textarea. Manoj Sterex wrote: > > Well, instead of storing the text from the textarea directly into the db, > validate it and wrap it with t

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread PHPScriptor
Well, the problem is that I have a lot of forms, a lot of data to output, and even then, I don't know always where I have a textarea or just a inputfield. But true, I could even set the nl2br on an input field, it wouldn't make a difference. But I just don't understand why this problem exists? Wha

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread PHPScriptor
Mja, that's not my intention, in that case I also could use nl2br... Why does this problem exists? And why does it work with ? Is this a PHP problem or more a HTML problem? Robert Cummings wrote: > > On Fri, 2009-05-15 at 07:03 -0700, PHPScriptor wrote: >> Hello, >> >> How do you guys handle

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Manoj Sterex
Well, instead of storing the text from the textarea directly into the db, validate it and wrap it with tags (replace \n) and then store it. This way you needn't use nl2br every time you retrieve the text from db. -Sterex On Fri, May 15, 2009 at 7:42 PM, Stuart wrote: > 2009/5/15 PHPScriptor :

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Stuart
2009/5/15 PHPScriptor : > > Hello, > > How do you guys handle this "problem". > > Just a form with a textarea. When I use enters in the textarea it's saved to > the db like this: > > database: > "first line > second line" > > when I edit the value in the form: > "first line > second line" > > when

Re: [PHP] textarea new line to mysql database

2009-05-15 Thread Robert Cummings
On Fri, 2009-05-15 at 07:03 -0700, PHPScriptor wrote: > Hello, > > How do you guys handle this "problem". > > Just a form with a textarea. When I use enters in the textarea it's saved to > the db like this: > > database: > "first line > second line" > > when I edit the value in the form: > "fir