Page 1 of 1

Getting rid of \' when sending mail

Posted: Mon Apr 03, 2006 10:39 am
by VKX
When I send mail using the form on my site, all the ' marks have \ marks right before them. For instance, if I send

It was Eric's birthday

using my webform, I'll get an email saying

It was Eric\'s birthday

How can I get rid of that \ ?

Posted: Mon Apr 03, 2006 10:49 am
by feyd

Posted: Mon Apr 03, 2006 12:14 pm
by Burrito
this is something that I use regularly.

Code: Select all

if (get_magic_quotes_gpc() ) 
{ 
   $fnStripMagicQuotes = create_function('&$mData, $fnSelf', 
       'if (is_array($mData)) foreach ($mData as $mKey=>$mValue) $fnSelf($mData[$mKey], $fnSelf); '.
       'else $mData = stripslashes($mData);');
   $fnStripMagicQuotes($_POST,$fnStripMagicQuotes);
   $fnStripMagicQuotes($_GET,$fnStripMagicQuotes);
   $fnStripMagicQuotes($_COOKIE,$fnStripMagicQuotes);
   $fnStripMagicQuotes($_SERVER,$fnStripMagicQuotes);
} // end if

if (get_magic_quotes_runtime())
{
  set_magic_quotes_runtime(0);
}