PHP HTML Formatting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jr
Forum Commoner
Posts: 99
Joined: Mon Mar 07, 2005 3:25 pm

PHP HTML Formatting

Post 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.
cbrian
Forum Commoner
Posts: 97
Joined: Sun Feb 27, 2005 12:29 pm

Post by cbrian »

Jr
Forum Commoner
Posts: 99
Joined: Mon Mar 07, 2005 3:25 pm

Post 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?
Jr
Forum Commoner
Posts: 99
Joined: Mon Mar 07, 2005 3:25 pm

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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().
Jr
Forum Commoner
Posts: 99
Joined: Mon Mar 07, 2005 3:25 pm

Post by Jr »

ok... figured it out... thanks for the help
Post Reply