Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /site.ru/request.php:1) in /site.ru/request.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /site.ru/request.php:1) in /site.ru/request.php on line 84
session_start();
header('location: ' . $_SERVER['HTTP_REFERER']);
<?php
session_start();
$mail_to = 'mail@yandex.ru';
if(isset($_POST['send_req']))
{
$sub = 'Новая заявка - Запрос на услуги';
}
if(isset($sub))
{
$error = '';
if(isset($_POST['name']))
{
$name = $_POST['name'];
$n = 'Имя: ' . $name;
if(strlen($name) == 0)
{
$error = 'Введите имя';
}
}
if(isset($_POST['phone']))
{
$phone = $_POST['phone'];
$p = 'Телефон: ' . $phone;
if(strlen($phone) == 0)
{
$error = 'Введите ваш телефон';
}
}
if(isset($_POST['email']))
{
$email = $_POST['email'];
$e = 'Email: ' . $email;
if (strlen($email) == 0)
{
$error = 'Введите ваш email';
}
} else
{
$email = 'no-reply@gmail.com';
}
if(isset($_POST['message']))
{
$message = $_POST['message'];
$m = 'Сообщение: ' . $message;
if (strlen($message) == 0)
{
$error = 'Введите ваш вопрос';
}
}
if(strlen($error) == '')
{
$to = $mail_to;
$subject = $sub;
$message = 'Тема: ' . $sub . "\r\n" .
$n . "\r\n" .
$p . "\r\n" .
$e . "\r\n" .
$m . "\r\n" ."\r\n" .
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$_SESSION['success'] = 1;
header('location: ' . $_SERVER['HTTP_REFERER']);
}
}