Sunday, 29 September 2013

Store the line break from textarea , store to database and show on frontend?

Store the line break from textarea , store to database and show on frontend?

Currently I am working on storing textarea paragraph
<textarea rows="10"></textarea>
I can save the whole content but the problem is it does not include line
breaks. I wonder what is the best practice of storing the space/line break
from the textarea to database. Also, I need to prevent the user from
inserting the inside the textarea.
Is it good parctice ?
e.g.
text=replace(text,"/n","<br>")
text=replace(text," ","&nbsp;")
text=replace(text,"<script>","")
text=replace(text,"</script>","")
Thanks

No comments:

Post a Comment