I am using formmailer for a simple form, and the problem is that when the user types in a ' character (single quote) the email comes in with a /'
So, for example, if I typed the following: Don't
into a text field on the form itself, it would come in the email as Don/'t
Is there a way to get rid of the / or escape out of the ' so that it doesn't cause it to add the forward slash?
Here is the form: www.chateauclassics.com/change.html
and my PHP form mailer code is below.
Thanks!
<?PHP
putenv("TZ=America/Denver");
//$testemail = "cbstott@gmail.com";
//a feeble attempt at a little security
if (!strstr($SERVER['HTTP_REFERER'],"chateauclassics.com") &&
!strstr($SERVER['HTTP_REFERER'],"xologic.com"))
{
echo "Sorry you do not have access to use this script.";
exit;
}
$date = date ("m/d/Y");
$time = date ("h:i A");
$msg = "Submitted on $date at $time.\n\n";
foreach ($POST as $key => $value)
{
//echo "$key:$value<br>";
if (!strstr($key,"emailerVal"))
{
$value = implode(" ",explode("\t",$value));
$msg .= ucfirst ($key) .":\t". $value . "\n";
}
}
$msg = implode(" ",explode("_",$msg));
if (!isset($POST[emailerVal_headers]))
{
$POST[emailerVal_headers] = "From: nicole@chateauclassics.com";
}
//echo "$POST[emailerVal_to], $POST[emailerVal_subject], $msg, $POST[emailerVal_headers]";
if (mail($POST[emailerVal_to], $POST[emailerVal_subject], $msg, $POST[emailerVal_headers]))
{
if (isset($POST[emailerVal_location]))
{
header("Location:$POST[emailerVal_location]");
}
else
{
echo "Your information has been sent successfully.";
}
}
else
{
echo "Unable to send your information please try again or contact the webmaster.";
}
?>