A user types multiple paragraphs in a text area, and then submits it to a php page. Is there an easy way (similar to addslashes() ) that I can append the <p> tag when they hit "Enter" twice and just the <br> tag when they hit "Enter" once?
I know that I could loop through $_POST variable searching for the newline character, but I didn't want to do this if there is already an inherent PHP function that does it for me. Also, if in a worse case scenerio I have to look for and replace the characters with HTML tags, what is the character for new line?
"\n" is the escape character for display, but if my text area is as follows:
and that gets posted to a page, what do I look for in $_POST["variable"] that represent a carriage return? Is it still the "\n".
Maybe there is a regular expression that would replace all carriage returns with <br> and all double carriage returns with <p>? Any help is very much appreciated.