jonybigude Posted June 19, 2013 Share Posted June 19, 2013 Hi!I have been searching on the web for solutions but for some reason it seems that I can't implement them. I am a rookie in PHP and perhaps the mistake has been under my nose all this time but I did not manage to see it...Here goes my contact form: <form method="post" action="kontakt.php"> <label>Namn *</label> <input name="name" placeholder="Type Here"> <label>Telefon *</label> <input name="telef" placeholder="Type Here"> <label>E-post *</label> <input name="email" type="email" placeholder="Type Here"> <label>Meddelandet</label> <textarea name="message" placeholder="Type Here"></textarea> <label>*Hur mycket är 2+2? (Anti-spam)</label> <input name="human" placeholder="Type Here"> <input id="submit" name="submit" type="submit" value="Submit"> <?php $name = $_POST['name']; $telef = $_POST['telef']; $email = $_POST['email']; $message = $_POST['message']; $from = 'Lounge Terrasse'; $to = '[email protected]'; $subject = 'Lounge Terrasse - Ny meddelande'; $human = $_POST['human']; $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "From: $from <$email> ". PHP_EOL; $headers .= "Content-type: text/html;charset=UTF-8 ". PHP_EOL; $body = "From: $name\n Telefon: $telef\n E-Mail: $email\n Message:\n $message"; if ($_POST['submit']) { if ($name != '' && $email != '' && $telef != '') { if ($human == '4') { if (mail ($to, $subject, $body, $from)) { echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } else if ($_POST['submit'] && $human != '4') { echo '<p>You answered the anti-spam question incorrectly!</p>'; } } else { echo '<p>You need to fill in all required fields!!</p>'; } } ?> </form> So... any suggestions in order to implement correctly the utf8, since the e-mails are still coming with weird characters?Thanks in advance!! Link to comment https://forums.phpfreaks.com/topic/279357-utf8-in-my-contac-form-not-working/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.