Answer the question
In order to leave comments, you need to log in
Syntax error, unexpected T_VARIABLE and why?
<?php
//print_r($_POST);
$email = $_POST['email'];
$message = $_POST['email'];
$Error = '';
if(trim($email == '')
$Error = 'Введите ваш email';
else if(trim($message) == '')
$Error = 'Введите сообщение';
else if(strlen($message) <10)
$Error = 'Сообщение должно быть более 10 символов';
if($Error != ''){
echo $Error;
exit;
}
$subject ="=?utf-8?B?".base64_encode("Тестовое сообщение"). "?=";
$headers ="From: $email\r\nReplay-to: $email \r\nContent-type: text/html;charset=utf-8\r\n";
mail('[email protected]', $subject, $message, $headers);
?>
Answer the question
In order to leave comments, you need to log in
spandae and so there is no error?
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'] ?? '';
$message = $_POST['email'] ?? '';
$error = '';
if (trim($email) == ''){
$error = 'Введите ваш email';
} elseif (trim($message) == '') {
$error = 'Введите сообщение';
} elseif (strlen($message) < 10) {
$error = 'Сообщение должно быть более 10 символов';
}
if ($error) {
echo $error;
} else {
$subject = "=?utf-8?B?" . base64_encode("Тестовое сообщение") . "?=";
$headers = "From: $email\r\nReplay-to: $email \r\nContent-type: text/html;charset=utf-8\r\n";
mail('[email protected]', $subject, $message, $headers);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question