Mail form med ÆØÅ problemer
formen virker fint, bortset fra når jeg modtager min mail, så er æøå lavet om til æøå.Hvad går galt??
Min form ser sådan ud
<form action="../../wp-content/FormToEmail.php" method="post" accept-charset="UTF-8">
<table style="height: 32px;" border="0" width="482">
<tbody>
<tr align="left">
<td width="110px">Navn</td>
<td><input name="navn" size="30" type="text" /></td>
</tr>
</tbody>
</table>
<table style="height: 32px;" border="0" width="481">
<tbody>
<tr align="left">
<td width="110px">Efternavn</td>
<td><input name="efternavn" size="30" type="text" /></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td width="110px">Skole</td>
<td><select class="special" name="Skole" size="1"> <option class="special">Korsør ProduktionsHøjskole</option> </select></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr align="left">
<td width="110px">Telefon nr</td>
<td><input name="telefon nr 1" size="30" type="text" /></td>
<td>*</td>
<td><input name="telefon nr 2" size="30" type="text" /></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr align="left">
<td width="110px">Email</td>
<td><input name="email" size="30" type="text" /></td>
</tr>
</tbody>
</table>
<table style="height: 32px;" border="0" width="453">
<tbody>
<tr align="left">
<td width="110px">Antal</td>
<td><input name="antal" size="20" type="text" /></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr align="left">
<td width="110px" valign="top">Kommentar</td>
<td><textarea cols="30" rows="6" name="kommentar"></textarea></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr align="left">
<td></td>
<td><input type="submit" value="Send" /><span style="font-family: arial; font-size: xx-small;"> </span></td>
</tr>
</tbody>
</table>
</form>
Og min PHP fil ser sådan ud:
<?php
error_reporting(E_ALL ^ E_NOTICE);
$my_email = "Steen@xor.dk";
/*
Optional. Enter a From: email address. Only do this if you know you need to. By default, the email you get from the script will show the visitor's email address as the From: address. In most cases this is desirable. On the majority of setups this won't be a problem but a minority of hosts insist that the From: address must be from a domain on the server. For example, if you have the domain example.com hosted on your server, then the From: email address must be something@example.com (See your host for confirmation). This means that your visitor's email address will not show as the From: address, and if you hit "Reply" to the email from the script, you will not be replying to your visitor. You can get around this by hard-coding a From: address into the script using the configuration option below. Enabling this option means that the visitor's email address goes into a Reply-To: header, which means you can hit "Reply" to respond to the visitor in the conventional way. (You can also use this option if your form does not collect an email address from the visitor, such as a survey, for example, and a From: address is required by your email server.) The default value is: $from_email = ""; Enter the desired email address between the quotes, like this example: $from_email = "contact@example.com"; In these cases, it is not uncommon for the From: ($from_email) address to be the same as the To: ($my_email) address, which on the face of it appears somewhat goofy, but that's what some hosts require.
*/
$from_email = "";
/*
Optional. Enter the continue link to offer the user after the form is sent. If you do not change this, your visitor will be given a continue link to your homepage.
If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"
*/
$continue = "http://www.pro-net-projekt.eu/internt_internes/formularer/bestil-visitkort/tak-for-din-bestilling";
/*
Step 3:
Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above!
THAT'S IT, FINISHED!
You do not need to make any changes below this line.
*/
$errors = array();
// Remove $_COOKIE elements from $_REQUEST.
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
// Validate email field.
if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
{
$_REQUEST['email'] = trim($_REQUEST['email']);
if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
}
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Check for a blank form.
function recursive_array_check_blank($element_value)
{
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
}
}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
// Build message.
function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
$message = build_message($_REQUEST);
$message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Korsør ProduktionsHøjskole ( ProNet Visitkort Bestilling )";
$message = stripslashes($message);
$subject = "ProNet Visitkort Bestilling";
$subject = stripslashes($subject);
if($from_email)
{
$headers = "From: " . $from_email;
$headers .= PHP_EOL;
$headers .= "Reply-To: " . $_REQUEST['email'];
}
else
{
$from_name = "";
if(isset($_REQUEST['navn']) && !empty($_REQUEST['navn'])){$from_name = stripslashes($_REQUEST['navn']);}
$headers = "From: {$from_name} <{$_REQUEST['email']}>";
}
mail($my_email,$subject,$message,$headers);
header('Location: http://www.pro-net-projekt.eu/internt_internes/formularer/bestil-visitkort/tak-for-din-bestilling');
?>
