[PHP] textarea new line to mysql database
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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560478.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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: first line second line when I output the value to html: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? Not to the DB, but it should respect newlines if you wrap it in pre/pre tags. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
Well, instead of storing the text from the textarea directly into the db, validate it and wrap it with br / 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 stut...@gmail.com wrote: 2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 pre? 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 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? Not to the DB, but it should respect newlines if you wrap it in pre/pre tags. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560765.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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? What's the reason? Stuart-47 wrote: 2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560853.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 linebr /second 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 br / 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 stut...@gmail.com wrote: 2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560882.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 br / 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's a cached entry in the DB. Unless you absolutely know you'll never need the raw text again, you should always store the raw text so it can be processed in the future in any way you see fit. If you want to speed up the process of conversion, use an additional field in the database, or a cache, that contains the processed content. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 form: first line second line when I output the value to html: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? If I understand your question, the answer is no. If you have wrap=hard as an attribute for your textarea, it will store the data with CR/LF. But CR/LF don't show up as a line ending when displayed in HTML. You have to use nl2br() to translate for HTML. It also may be that you need to do a translation from CR/LF (textarea line ending) to LF (*nix line ending). The CR/LF *will* show up properly when *editing* in the textarea field, just not when displayed without a textarea. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 browser does not recognize '\n' as a line break; it only recognizes 'br /'. Coming to the pre tag, pre stands for preformatted; it tells the browser to output the text in the raw format as it is. Hence it displays properly. -Sterex On Fri, May 15, 2009 at 7:54 PM, PHPScriptor cont...@phpscriptor.comwrote: 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 linebr /second 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 br / 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 stut...@gmail.com wrote: 2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560882.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
@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 when you are editing the text again, it will be properly formatted. You'll also get toolbars for text editing etc., more like your mail compose window right now. :) -Sterex On Fri, May 15, 2009 at 7:56 PM, Robert Cummings rob...@interjinn.comwrote: 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 br / 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's a cached entry in the DB. Unless you absolutely know you'll never need the raw text again, you should always store the raw text so it can be processed in the future in any way you see fit. If you want to speed up the process of conversion, use an additional field in the database, or a cache, that contains the processed content. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
TinyMCE: http://tinymce.moxiecode.com/ -Sterex On Fri, May 15, 2009 at 7:56 PM, Paul M Foster pa...@quillandmouse.comwrote: 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 form: first line second line when I output the value to html: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? If I understand your question, the answer is no. If you have wrap=hard as an attribute for your textarea, it will store the data with CR/LF. But CR/LF don't show up as a line ending when displayed in HTML. You have to use nl2br() to translate for HTML. It also may be that you need to do a translation from CR/LF (textarea line ending) to LF (*nix line ending). The CR/LF *will* show up properly when *editing* in the textarea field, just not when displayed without a textarea. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
2009/5/15 PHPScriptor cont...@phpscriptor.com: 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? What's the reason? Trust me when I say in the grand scheme of things a call to nl2br is extremely cheap so I really wouldn't worry about how much you use it. If you don't know whether you're using a input field or a textarea I really think you need to examine your code carefully before proceeding. If you know to spit out a textarea then you know it's a textarea. Or maybe I'm missing something. The reason this problem exists is due to HTML compressing concurrent white space into a single space. This can be a very useful feature but is not immediately obvious to newcomers. If you're not familiar with HTML I suggest you put PHP down for a while and have a play with pure HTML - it'll be time well-invested. -Stuart -- http://stut.net/ Stuart-47 wrote: 2009/5/15 PHPScriptor cont...@phpscriptor.com: 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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? What's your problem with using nl2br? This is the reason it exists!! Store the raw data in the database, and run nl2br on it when you display it. I don't see a problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/ -- View this message in context: http://www.nabble.com/textarea-new-line-to-mysql-database-tp23560478p23560853.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 don't understand why this problem exists? What's the reason? Simply, the problem deals with how different systems handle the end of line (EOL) character? You can read more about it here: http://en.wikipedia.org/wiki/Newline What you've encountered (IMO) is just another extension/example of the problem. Now, your choices are to: 1. Listen to Rob (the wisest) and use the pre tag. 2. Listen to Stuart (the wisest) and use the nl2br() function 3. Listen to Sterex (IMO -- who is totally wrong) and put html in your database; 4. Or, listen to me (who is somewhere between Rob/Stuart and Sterex) and use either the pre tag or the nlbr() function depending upon what you want to do with the output. Both solutions [1 and 2] provide different ways to handle data. Number [3] simply creates another problem you, or someone else, will have to deal with later on. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
@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 tedd.sperl...@gmail.com 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 an input field, it wouldn't make a difference. But I just don't understand why this problem exists? What's the reason? Simply, the problem deals with how different systems handle the end of line (EOL) character? You can read more about it here: http://en.wikipedia.org/wiki/Newline What you've encountered (IMO) is just another extension/example of the problem. Now, your choices are to: 1. Listen to Rob (the wisest) and use the pre tag. 2. Listen to Stuart (the wisest) and use the nl2br() function 3. Listen to Sterex (IMO -- who is totally wrong) and put html in your database; 4. Or, listen to me (who is somewhere between Rob/Stuart and Sterex) and use either the pre tag or the nlbr() function depending upon what you want to do with the output. Both solutions [1 and 2] provide different ways to handle data. Number [3] simply creates another problem you, or someone else, will have to deal with later on. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 an input field, it wouldn't make a difference. But I just don't understand why this problem exists? What's the reason? Simply, the problem deals with how different systems handle the end of line (EOL) character? You can read more about it here: http://en.wikipedia.org/wiki/Newline What you've encountered (IMO) is just another extension/example of the problem. Now, your choices are to: 1. Listen to Rob (the wisest) and use the pre tag. 2. Listen to Stuart (the wisest) and use the nl2br() function 3. Listen to Sterex (IMO -- who is totally wrong) and put html in your database; 4. Or, listen to me (who is somewhere between Rob/Stuart and Sterex) and use either the pre tag or the nlbr() function depending upon what you want to do with the output. Both solutions [1 and 2] provide different ways to handle data. Number [3] simply creates another problem you, or someone else, will have to deal with later on. Actually, after reading the other posts with respect to what he's trying to do, I would use nl2br() unless I specifically needed pre/pre. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 pre? Is this a PHP problem or more a HTML problem? HTML doesn't recognize newlines when it displays text. The pre tag maintains the formatting of your original text, including newlines. Unfortunately, it also displays text in a monospace font. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 pre? Is this a PHP problem or more a HTML problem? HTML doesn't recognize newlines when it displays text. The pre tag maintains the formatting of your original text, including newlines. Unfortunately, it also displays text in a monospace font. You can style a pre tag. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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. :) -Sterex Thanks for taking my comment without flaming. What I said was based upon having to deal with clients who mix html and all sorts of stuff in their database and then wonder why certain pages look funny. They can't seem to grasp the concept of paired tags. To them b means to make this section bold and quit somewhere it looks best. It's been an experience and that has left me with the opinion that civilians should stay the hell out of the programming -- just tell us what they want and not how to do it. Pardon my slant on things. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 pre? Is this a PHP problem or more a HTML problem? HTML doesn't recognize newlines when it displays text. The pre tag maintains the formatting of your original text, including newlines. Unfortunately, it also displays text in a monospace font. Paul I believe that you can override that with css. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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: first linesecond line (unless I use nl2br()) Is there a way that I could save it to the db that will work for db, output and edit without using any other function like nl2br? I run all text area through a filter that removes the carriage return [ preg_replace('/\r/','',$input) ] and save it in the database with any newline characters. When calling data from the database, I can then use newline as a delimiter for explode generate an array where each element of the array is a distinct line of text - and then do whatever I want with the lines. Effectively what I usually do is the same thing as nl2br - but since I do everything in DOMDocument I have to do it myself (create text nodes for each array element and create break nodes between them). If I'm going to a pre field or back to a text area (IE to edit the data) then I don't have to do anything. I do NOT recommend running nl2br before it goes into the database - as that means you may have to convert the breaks when re-using the data elsewhere, and the proper way to make a break depends upon the output type (IE br for html or br / for xhtml, etc.) - so keep the newline character in the database and convert to what you need when you call the data from the database. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
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 pre tag or the nlbr() function depending upon what you want to do with the output. Both solutions [1 and 2] provide different ways to handle data. Number [3] simply creates another problem you, or someone else, will have to deal with later on. Actually, after reading the other posts with respect to what he's trying to do, I would use nl2br() unless I specifically needed pre/pre. Cheers, Rob. -- That would be my first choice as well. However, one can style a pre tag whereas it's very difficult (if not impossible) to style what goes in between br / tags. Also, one can generate validation errors using br / because there are three different varieties of the tag, namely br, br /, and br/ -- 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 problem before. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
tedd wrote: Also, one can generate validation errors using br / because there are three different varieties of the tag, namely br, br /, and br/ -- 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 problem before. That's where DOMDocument helps - saveHTML() produces valid html break, saveXML() produces valid xhtml break, all from the same DOMDocument object. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
On 5/15/09 10:12 AM, Stuart stut...@gmail.com 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, visit: http://www.php.net/unsub.php
Re: [PHP] textarea new line to mysql database
At 2:10 PM -0400 5/15/09, Tom Worster wrote: On 5/15/09 10:12 AM, Stuart stut...@gmail.com 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 you were just another pretty face. Good point. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php