D
D
Dmitry Zabelin2018-06-18 22:46:13
PHP
Dmitry Zabelin, 2018-06-18 22:46:13

Emails are sent only from the main page, why?

Hello dear pros! And again I bow to you.
Faced a problem. I have a form with validation check and then submit.
Validation works fine, the letter is sent, but for some reason only from the main page of the site ... The call button in the header, the form in the footer, the header and footer are connected to all pages of the site. Why are emails not being sent from other pages?

<?php
header("Content-Type: text/html; charset=utf-8");
$name = htmlspecialchars($_POST["name"]);
$tel = htmlspecialchars($_POST["tel"]);
$target = htmlspecialchars($_POST["target"]);


$refferer = getenv('HTTP_REFERER');
$date=date("d.m.y"); 
$time=date("H:i");
$myemail = "[email protected]";

// Отправка письма администратору сайта
$tema = "У вас клиет";
$message_to_myemail = "Текст письма: Здесь текст письма которое читает админ сайта.
<br><br>
Модал:$target<br>
Имя: $name<br>
Телефон: $tel<br>

";

mail($myemail, $tema, $message_to_myemail, "From: Sitename <[email protected]> \r\n Reply-To: Sitename \r\n"."MIME-Version: 1.0\r\n"."Content-type: text/html; charset=utf-8\r\n" );

$f = fopen("leads.xls", "a+");
fwrite($f," <tr>");    
fwrite($f," <td>$target</td> <td>$name</td> <td>$tel</td>   <td>$date / $time</td>"); 
fwrite($f," <td>$refferer</td>");    
fwrite($f," </tr>");  
fwrite($f,"\n ");    
fclose($f);

?>

As I understand it, something needs to be added, but I'm not boom boom in PHP ;(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-06-18
@DModUA

<form action="something.php" >
before something put /

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question