Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-27-2012, 02:04 PM   PM User | #1
vineet
Regular Coder

 
Join Date: Jun 2008
Posts: 173
Thanks: 2
Thanked 9 Times in 9 Posts
vineet is an unknown quantity at this point
htmlspecialchars for email content

hi all

I have this below code for <textarea> in which person enters his enquiry

PHP Code:
$body="Hi \n<br><br>".htmlspecialchars($name). " had sent you enquiry . ".  " \n<br><br>
Person Enquiry = "
htmlspecialchars($enquiry) . " \n<br><br> "
mail($to,$body); 
after person enters enquiry the email is sent with the enquiry entered.

i receive enquiry content as

Code:
yo man\r\n\r\ntesting new site\r\n\r\nstay tuned\r\n\r\nvineet
how can i use htmlspecialchars in the way it doesnt echoes \r\n\r\

vineet
vineet is offline   Reply With Quote
Old 10-27-2012, 11:18 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,448
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Well those characters wouldn't be visible in an HTML email and you shouldn't be using htmlspecialchars for a plain text email so presumably the solution is to get rud of the htmlspecialchars call that shouldn't be there so as to allow the plain text to display properly in the email.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:28 AM.


Advertisement
Log in to turn off these ads.