Answer the question
In order to leave comments, you need to log in
Why isn't HTML form data being sent to mail by PHP?
Why is this form not being sent by email?
The form:
<form action="handlers/handler.php" method="POST">
<div class="form-input form-input-name">
<input type="text" name="name" placeholder="Введите имя" minlength="2" size="14" required>
</div>
<div class="form-input">
<input id="phone-header" type="text" name="phone" placeholder="Введите телефон" size="14" required>
</div>
<div class="form-btn">
<button class="button orange" style="color: #FFF;" type="submit">Отправить</button>
</div>
</form>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$name = htmlspecialchars($name);
$phone = htmlspecialchars($phone);
$name = urldecode($name);
$phone = urldecode($phone);
$name = trim($name);
$phone = trim($phone);
if (mail("[email protected]", "Заявка с сайта", "Имя:".$name.". Телефон: ".$phone ,"From: [email protected] \r\n"))
{ echo "сообщение успешно отправлено";
} else {
echo "при отправке сообщения возникли ошибки";
}?>
Answer the question
In order to leave comments, you need to log in
At least by the fact that you have a group of tasks submitted as one question. First determine at what stage you are failing, and then ask a specific question about a specific problem. var_dump() to help. And the order in the code... is missing, half of the variables, hell knows where it came from, the second is not used anywhere...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question