unexpected escape characters in text email...
Posted: Tue Oct 14, 2003 12:58 pm
I use PHP and MySQL for submission and processing of new account applications via our web site. The applications are submitted through HTML forms and PHP to a MySQL table, then the data is retreived similarly and sent as a plain text email to our customer service department.
For one reason or another, sometime's applicants need to use the single quote (') or apostrophe (`) -- examples would be Macy`s or D'Amelio. This is resulting in a problem -- the email converts D'Amelio to D\'Amelio and Macy`s to Macy\`s.
I've tried structuring the email content as both
$email_content1 = "Dear".$sirnm." ".$lname.",\n";
and
$email_content2 = "Dear $fname $lname,\n";
but I have the same result either way. The content of the MySQL table does show the text properly as D'Amelio. Also, I'm using a basic mail(); command with no specific headers in it.
My assumption is that it's one of three things -- a) I need to define the mail headers more specifically, b) I need to restructure the MySQL query, or c) I need to restructure my variables.
I understand that ', ", and ` are used by PHP to enclose strings, etc...
It would make sense if I got a variable error, or if (\') was converted to ('), since (') is reserved; however, why would is convert (') to (\')?
Wouldn't that be like a line break being converted to (\n), rather than (\n) being converted to a line break?
Does anyone have an idea as to how I can correct this?
Thanks,
Eric Baze, Creative Specalist
ConferenceCall.com
ebaze@conferencecall.com
For one reason or another, sometime's applicants need to use the single quote (') or apostrophe (`) -- examples would be Macy`s or D'Amelio. This is resulting in a problem -- the email converts D'Amelio to D\'Amelio and Macy`s to Macy\`s.
I've tried structuring the email content as both
$email_content1 = "Dear".$sirnm." ".$lname.",\n";
and
$email_content2 = "Dear $fname $lname,\n";
but I have the same result either way. The content of the MySQL table does show the text properly as D'Amelio. Also, I'm using a basic mail(); command with no specific headers in it.
My assumption is that it's one of three things -- a) I need to define the mail headers more specifically, b) I need to restructure the MySQL query, or c) I need to restructure my variables.
I understand that ', ", and ` are used by PHP to enclose strings, etc...
It would make sense if I got a variable error, or if (\') was converted to ('), since (') is reserved; however, why would is convert (') to (\')?
Wouldn't that be like a line break being converted to (\n), rather than (\n) being converted to a line break?
Does anyone have an idea as to how I can correct this?
Thanks,
Eric Baze, Creative Specalist
ConferenceCall.com
ebaze@conferencecall.com