Escaped apostrophe in the email
Posted: Thu Jun 01, 2006 11:54 am
I am still having trouble with the apostrophes being escaped in the email. We've managed to get rid of the excape everywhere else but in the email. Here's the code.
THANKS!!! lauren
Code: Select all
function email($ad, $orderNo, $orderTot, $firstName, $lastName, $address1, $address2, $city, $state, $zip, $telephone, $cemail, $where, $startDate, $endDate, $message)
{
# Need to include the IP address of the sender of the email -
# just in case there is any abuse
$ip = get_remote_ip();
$ad = $_POST['ad']; $ad = ltrim($_POST['ad']);
$orderNo = ltrim($_POST['orderNo']);
$firstName = stripslashes($_POST['firstName']); $firstName = ltrim($_POST['firstName']);
$lastName = stripslashes($_POST['lastName']); $firstName = ltrim($_POST['firstName']);
$address1 = stripslashes($_POST['address1']); $address1 = ltrim($_POST['address1']);
$address2 = stripslashes($_POST['address2']); $address1 = ltrim($_POST['address1']);
$city = stripslashes($_POST['city']); $city = ltrim($_POST['city']);
$state = stripslashes($_POST['state']); $state = ltrim($_POST['state']);
$zip = stripslashes($_POST['zip']); $zip = ltrim($_POST['zip']);
$telephone = stripslashes($_POST['telephone']); $telephone = ltrim($_POST['telephone']);
$cemail = stripslashes($_POST['cemail']); $cemail = ltrim($_POST['cemail']);
$where = $_POST['where'];
$startDate = ltrim($_POST['startDate']);
$endDate = ltrim($_POST['endDate']);
$message = stripslashes($_POST['message']); $message = ltrim($_POST['message']);
$message = htmlspecialchars($message);
# Need to include the day of the week after the date
# in the email
$startDay = date("l",mktime(0,0,0,substr($startDate,0,2),substr($startDate,3,2),substr($startDate,8,2)));
$endDay = date("l",mktime(0,0,0,substr($endDate,0,2),substr($endDate,3,2),substr($endDate,8,2)));
$to = "communitychannel@.net";
$subject = "Message or Ad Posting for the Community Channel";
$mailheaders = "From: $cemail \n";
$mailheaders .= "Reply-To: $cemail\n\n";
$msg = "E-mail sent from: Community Channel's Online Services \n\n";
$msg .= "First Name: \t $firstName \n";
$msg .= "Last Name: \t $lastName \n";
$msg .= "Address: \t $address1\n";
$msg .= "Address 2: \t $address2 \n";
$msg .= "City: \t\t $city \n";
$msg .= "State: \t\t $state\n";
$msg .= "Zip Code: \t$zip\n";
$msg .= "Telephone: \t$telephone\n";
$msg .= "E-mail: \t$cemail\n\n";
$msg .= "Order Number: \t $orderNo \n";
$msg .= "Message or Ad: \t $ad \n\n";
$msg .= "Communities where the message or ad should appear: $where \n\n";
$msg .= "Message or Ad Start Date: \t $startDate \t $startDay \n";
$msg .= "Message or Ad End Date: \t $endDate \t $endDay \n\n";
$msg .= "Message or Ad Text: \t stripslashes($message) \n\n";
$msg .= "IP Address: \t $ip ";
if(mail($to, $subject, $msg, $mailheaders)) { ?>
<div class="contentheader">Thank You For Using Our Online Services</div><br>
<div class="mediumtext">Your <?php echo ($ad); ?>has been <br>emailed to the Community Channel for processing.<br><br>Thank you for using Community Channel's online services.</div>
<? }else{ ?>
<div class="mediumtext">There was a problem sending the email. Please make sure that you completed the form correctly.</div>
<? }
} // end of email function