php форма с implode (& quot; \ n & quot ;, $ email_headers) не добавляет пробел

У меня есть почтовый код php, и он не отправляется с пробелами. У меня должен быть utf-8 в заголовках писем, иначе он не распознает ошибки. Я хочу добавить ввод, как это:
Имя: ххх
Эпост: ххх
Nettside: ххх
Телефон: ххх
Плавка: ххх
Прямо сейчас он печатает все в одном предложении, как: name: xxx epost: xxx …
Заранее спасибо.

<?php
// Get the form fields, removes html tags and whitespace.
$navn = strip_tags(trim($_POST["navn"]));
$navn = str_replace(array("\r","\n"),array(" "," "),$navn);
$epost = filter_var(trim($_POST["epost"]), FILTER_SANITIZE_EMAIL);
$henvendelse = trim($_POST["henvendelse"]);
$nettside = trim($_POST["nettside"]);
$telefon = trim($_POST["telefon"]);

// Check the data.
if (empty($navn) OR empty($henvendelse) OR !filter_var($epost, FILTER_VALIDATE_EMAIL)) {
header("Location: http://www.noorwebdesign.no/index.php?success=-1#form");
exit;
} else {
// Redirect to the index.html page with success code
header("Location: http://www.noorwebdesign.no/index.php?success=1#form");
}

// Set the recipient email address. Update this to YOUR desired email address.
$recipient = "post@noorwebdesign.no";

// Set the email subject.
$subject = "$navn";

// Build the email content.
$email_content = "Navn: $navn\n";
$email_content .= "Epost: $epost\n";
$email_content .= "Nettside:\n$nettside\n";
$email_content .= "Telefon:\n$telefon\n\n";
$email_content .= "Melding:\n$henvendelse\n";

// Build the email headers.
$email_headers = array("Content-Type: text/html;charset=utf-8");

// Send the email.
mail($recipient, $subject, $email_content, implode("\n", $email_headers));

?>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector