1

I have an email php form that get the message from a input nicedit text.

enter image description here

in my php headers code I'm using:

$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

everything works fine except if I want to add a link or a picture.

Nicedit translates my message adding backslash() before and after the tags:

test a <a =\"http://example.com\" title=\"example\" target=\"_blank\">link</a>

Any Idea why is this happening?

SNos
  • 3,430
  • 5
  • 42
  • 92
  • Is it in nicedit or when you submit the form? Could be magic quotes on in your PHP config, http://php.net/manual/en/security.magicquotes.what.php – chris85 Apr 08 '15 at 01:38
  • its happening when I submit the form.. the link doesn't work because is formatted wrong.. Thanks I will check the link – SNos Apr 08 '15 at 01:40
  • Yes, it sounds like it is your PHP converting the input, not nicedit. Look in your php.ini file and see if magic quotes is turned on. http://php.net/manual/en/security.magicquotes.disabling.php – chris85 Apr 08 '15 at 01:41
  • It sounds like this is the problem.. but where I found the php.ini? I am using wordpress – SNos Apr 08 '15 at 01:44
  • Here's a thread on how to find that location, http://stackoverflow.com/questions/8684609/dude-wheres-my-php-ini. It should be outside of Wordpress. – chris85 Apr 08 '15 at 01:48
  • I have tried nothing works.. I have also contacted my host and they replayed saying : "We do not support magic_quotes_gpc and it is already disabled in our server." – SNos Apr 08 '15 at 02:04

2 Answers2

0

It is escaping the double quotes.

You can use stripslashes() to remove them.

If stripslashes() does not work then double quote the phrase.

The purpose is to escape double quotes when double quotes are double quoted.

$message = "test a <a =\"http://example.com\" title=\"example\" target=\"_blank\">link</a>";
Misunderstood
  • 5,534
  • 1
  • 18
  • 25
  • thank you.. I am trying like $email_message .= " ".stripcslashes($comments)."\n"; but not working – SNos Apr 08 '15 at 02:26
  • From PHP manual. Note: If magic_quotes_sybase is on, no backslashes are stripped off but two apostrophes are replaced by one instead. There is a simple solution, see my edits. – Misunderstood Apr 08 '15 at 02:31
  • thanks I have salved using $email_message .= stripcslashes("$comments"); – SNos Apr 08 '15 at 03:11
0

For future Reference the solution was:

$email_message .= stripcslashes("$comments");
SNos
  • 3,430
  • 5
  • 42
  • 92