irfandayan Posted July 19, 2012 Share Posted July 19, 2012 I have mail function which gets mail message from a textarea. But whenever there is apostrophes and new line it show it like below. Example Output: Comments: You\\'re mailing address was wrong. Couldn\\'t you provide an other? Survey Answers: item : You\\'re making it well. Isn\\'t it?\nitem2 : It\\'d better to have a cup of tea?\n 1) There are three slashes added along with apostrophes. Is it likely something to do with magic escaping? is the stripslashes function the better option to remove it? 2) New line converted to \r\n. The issue is the \r\n might be a windows artifact. On a Linux server it might be \n only. Is it would be enough to use str_replace('\r\n', "\n", $message); ? Then str_replace("\n", "", $message); ? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 19, 2012 Share Posted July 19, 2012 You can use the get_magic_quotes_gpc function to test if magic quotes is enabled, and if it is then you need to use stripslashes on all form input. Do that before trying to deal with the newline issue, they might be the same issue. 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