I’m a relative newbee to php but have implemented a simple contact form and php script to collect data and send an email. The code I’m using is below: (this is based on an old tutorial on another site - tutvid)
[php]/* Subject and Email variable */
$emailSubject = $_POST['subject'];
$webMaster = '[email protected]';
/* Gathering data variables */
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$addressField = $_POST['address'];
$commentField = $_POST['comment'];
$mailinglistField = $_POST['mailinglist'];
$body = <<<EOD
Enquiry sent via domain.com contact form
From: $nameField
Email: $emailField
Phone: $phoneField
Address: $addressField
Mailing list: $mailinglistField
$commentField
EOD;
$headers = "From: $emailField\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
// Change to the URL you want to redirect to
$URL=“http://www.domain.com/contact.php?thank=you”;
header (“Location: $URL”); [/php]
My issue is hopefully a simple one to correct, but I wasn’t sure where to start. When someone fills the form out, sends it and has used characters like ’ - the resulting email displays the character as ’
How do I get the code to accept these characters? or is my problem on the form page itself?
Any help would be much appreciated. Thanks.