MinusMyThoughts Posted November 1, 2006 Share Posted November 1, 2006 hi again!...i've got a dynamically loading page now that displays the contents of my selected database entry for editing and so on. if this website were a game, i'd be winning. ...i've got a problem, though, with the way my textarea is reading the database. when i put my variable into the textarea, it's placing a <br/> after every line break......so, what i'm asking is this: can you take out HTML from a textarea and preserve the line breaks?...thanks!love,jason Link to comment Share on other sites More sharing options...
aspnetguy Posted November 1, 2006 Share Posted November 1, 2006 PHP <textarea...><? echo str_replace("<br/>","\n",$code); ?></textarea> Link to comment Share on other sites More sharing options...
MinusMyThoughts Posted November 1, 2006 Author Share Posted November 1, 2006 amazing, as always! except i ended up using:str_replace("<br />","",$code);when it was replacing it with "\n" i was causing something that should have looked like this:Test text.More test text.to look like this:Test text.More test text.so by replacing <br /> with nothing, i was able to keep the same formatting without having the potentially confusing HTML in the text......thanks again!love,jason Link to comment Share on other sites More sharing options...
justsomeguy Posted November 1, 2006 Share Posted November 1, 2006 You can also use this function to get of all or some tags:http://www.php.net/manual/en/function.strip-tags.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now