I have a contact form which submits to the php mail command, all works fine, but if you put in the mail message " or ’ i.e. I would like the 12" Cake Tin or Paul’s Cake Tin, then the delivered email adds a back slash before the " or ’
Any ideas why?
Form Code:
[code]
Your Name: |
|
Your Email: |
|
Your Telephone Number: |
|
Your Message: | |
CAPTCHA Image: | |
Please enter the CAPTCHA code from the above image here: | |
submit code:
[code]<?php
error_reporting(0);
// The rest of your Contact Page code goes here
error_reporting(0);
session_start();
if( $_SESSION[‘6_letters_code’] == $_POST[‘CAPTCHA’] && !empty($_SESSION[‘6_letters_code’] ) ) {
$to = "[email protected]";
$email_subject = “Email enquiry from www.homevisitframing.co.uk”;
$name = $_POST[‘name’];
$email = $_POST[‘email’];
$tel = $_POST[‘tel’];
$message = $_POST[‘message’];
$headers = “From: $email”;
$email_body = "You have received a new message from " . $name . ".\n\nEmail Address: " . $email . ".\n \nTelephone Number: " . $tel . ".\n \nMessage: " . $message;
mail($to,$email_subject,$email_body,$headers);
echo ‘
Thank You for your message, we will be in touch soon.
’;} else {
echo “Sorry, you have provided an invalid CAPTCHA code. Please CLICK HERE to try again.”;
}
// Destroy session after message is sent
session_unset();
session_destroy();
?> [/code]