Page 1 of 1
PHP HTML Formatting
Posted: Wed Apr 20, 2005 2:36 pm
by Jr
Ok ONE more question... I am just wondering how I would make a function to take a textarea form value and format it before it goes into a database (with the returns as <br>, etc.) Take it and put it back into a form when edited without <br> commands, etc.
Posted: Wed Apr 20, 2005 2:48 pm
by cbrian
Posted: Wed Apr 20, 2005 4:57 pm
by Jr
hmm... well, I'm not sure if I'm getting this right. So this nl2br() function takes <textarea>/user formatted text with just returns (no html tags) and puts <br> and <p> where the single and double returns are?
Posted: Wed Apr 20, 2005 5:15 pm
by Jr
ok... so i got that to take the text area formatted text and put it into the DB with <br /> tags all over the place so how do I get rid of those to put it back into the text area when being edited?
Posted: Wed Apr 20, 2005 5:56 pm
by feyd
you don't store the data in the database after running it through nl2br().. only on display should you run it through nl2br().
Posted: Thu Apr 21, 2005 11:52 am
by Jr
ok... figured it out... thanks for the help