Answer the question
In order to leave comments, you need to log in
Why is the php form not working on the site?
I made a feedback form with the following code:
<?php
$sendto = "[email protected]";
$username = $_POST['userpost_name'];
$usertel = $_POST['userpost_phone'];
// Тема сообщения
$subject = "Test!";
$headers = "From: " . strip_tags($usermail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($usermail) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8 \r\n";
// Структура сообщения
$msg = "<html><body style='font-family:Arial,sans-serif;'>";
$msg .= "<h2 style='font-weight:bold;border-bottom:1px dotted #ccc;'>Новый заказ!</h2>\r\n";
$msg .= "<p><strong>ФИО:</strong> ".$username."</p>\r\n";
$msg .= "<p><strong>ТЕЛЕФОН:</strong> ".$usertel."</p>\r\n";
$msg .= "</body></html>";
// Результат отправки
if(@mail($sendto, $subject, $msg, $headers)) {
header("Location: index-2.html");
} else {
echo "<center><img src='images/ne-tpravleno.png'></center>";
}
?>
Answer the question
In order to leave comments, you need to log in
Firstly, uncle, I clumsily made the header of the letter, here is a working example, pay attention to your extra spaces !!!:
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: ".$contact_email."\r\n";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question