View Full Version : <br> tags in php
Daniel Hollands
February 2nd, 2001, 15:40
me again, are you getting annoyed at me yet :) :)
How can I add the <br> tags to a text box once it's been placed in the database.
Like on this message board, each time
I hit enter
another <br> tag is
added
how do I do that :)))))))
Woofcat
February 2nd, 2001, 19:21
$message=nl2br($message);
Daniel Hollands
February 2nd, 2001, 19:31
so I would remove all html tags from the variable first, and then use this to add the <br> tags?
I guess it would be silly to do it the other way arround, because I would loose all the formatting that $message=nl2br($message); had done :-)
Beans
February 9th, 2001, 01:55
I think there's a funtion in PHP which strips all html tags.
use nl2br first before stripping the rest of the html tags
Woofcat
February 9th, 2001, 09:55
Either way works...
$message=nl2br(strip_tags($message));
or
$message=strip_tags(nl2br($message),'<br>');
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.