You are here: PHP E-mail characters changing « PHP Programming Language « IT news, forums, messages
PHP E-mail characters changing

Posted by Barry Morris on 07/20/07 14:58

Hello

I have a problem sending e-mails using PHP and a text area as the input
field, some characters are been changed in IE6/7 but not FireFox, is there a
workaround for this?

Tm Personl (note the and ) is coming through as Tîm Personèl

Here is a cut down PHP script followed by the form testmessageform.php code:

<?php
$AIS_FORM_TEMPLATE = 'testmessageform.php'; // Form footer name
$AIS_FORM_REDIRECTONCOMPLETION = 'reqsent.php'; // Form to display when
all okay


$AIS_DISPLAY = false;
$JOBTITLE = $_REQUEST["jobtitle"]; // set to a mandatory field of the
form to ascertain if already displayed
if (!isset($JOBTITLE)) {
$AIS_DISPLAY = true;
// Set form defaults here

} else {
$JOBTITLE = $_REQUEST["jobtitle"];
$MESSAGE = stripslashes($_REQUEST["message"]);
// Form Validation Routines go here.
$AIS_ERROR = '';
if (empty($JOBTITLE)) {
$AIS_ERROR = $AIS_ERROR . "Please enter a value for
jobtitle.<br><br>";
}

$AIS_DISPLAY = $AIS_ERROR <> '';
}
if ($AIS_DISPLAY==true) { // Either first display or validation
errors.
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
if (!$AIS_ERROR=="") { // There are validation errors, display at head
of form
?>
<style type="text/css">
<!--
.formerrors h2 {color: #FF0000;}
.formerrors {font-size: 14px; color: #FF0000; font-weight:
bold;position:relative;}
.formerrors2 {padding-left:20px;}
-->
</style>
<Div class="formerrors">
<h2>Please correct the following errors:</h2>
<Div class="formerrors2">
<?php echo $AIS_ERROR ?>
</div>
</Div>
<?php
}
include($AIS_FORM_TEMPLATE);

} else { // The form is complete and valid at this point so do action!
$AIS_MAILTO = 'my_email@address.com';
$AIS_MESSAGE = 'E-mail title'.
"\n".
'============'.
"\n".
"\nJob Title ".$JOBTITLE.
"\nJob Description Welsh\n".$MESSAGE.
"\n";
mail($AIS_MAILTO, "Subject goes here",
$AIS_MESSAGE, "From: $EMAIL" );
header("Location: ".$AIS_FORM_REDIRECTONCOMPLETION);
}
?>

*********************************************** testmessageform.php

<style type="text/css">
<!--
..tableline {
clear:both;
font-size:2px;
line-height:2px;
}
..tablinebig {
clear:both;
font-size:10px;
line-height:10px;
}
..itemname {
float:left;
width:150px;
padding-top:6px;
}
..iteminput {
float:left;
width:auto;
height:auto;
}
-->
</style>
<form method="POST" action="testmessage.php" name="testmessage">
<div class="tableline"> &nbsp;</div>
<div class="itemname">
Job Title
</div>
<div class="iteminput">
<input name="jobtitle" type="text" id="jobtitle" size="50" value="<?php
echo $JOBTITLE ?>" />
</div>
<div class="tableline">&nbsp;</div>
<div class="itemname">
Job Description Welsh
</div>
<div class="iteminput">
<textarea name="message" cols="50" rows="8"><?php echo $MESSAGE
?></textarea>
</div>
<div class="tableline">&nbsp;</div>
<div class="tableline">
<input type="submit" name="Submit" value="Submit" />
</div>
</form>




TIA

Barry Morris

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация