Why is the email with the feedback form comes up blank?

Hello. On the Landing there are two forms of feedback.
Form 1. From the popup
<form action="/send.php" method="POST" id="php-form-zvonok">
 <h1>Fill the form</h1><br>
 <span>to request a callback</span><br>
 <input type="text" name="name" placeholder="Your name *" required><br>
 <input type="text" name="phone" placeholder="Your phone *" required><br>
 <button type="submit" class="stoimost" onclick="yaCounter46950849.reachGoal('zayavka'); return true;">Request a call</button>
 </form>


Form works through

the <script>
 $(document).ready(function () {
 $("#php-form-zvonok").submit(function() {
 var form_data = $(this).serialize();
$.ajax({
 type: "POST",
 url: "send.php",
 data: form_data,
 success: function() {
 alert('Your message sent!');
},
 error: function() {
 alert('an error occurred');
}
});
 return false;
});
});

 </script>


Form 2
<form action="/send.php" method="POST" id="php-form-zayvka">
 <h1>Leave request</h1><br>
 <span>for a free calculation of your order</span><br>
 <input type="text" name="name" placeholder="Your name *" required><br>
 <input type="text" name="phone" placeholder="Your phone *" required><br>
 <input type="text" name="email" placeholder="Your email"><br>
 <button type="submit" class="stoimost" onclick="yaCounter46950849.reachGoal('zayavka'); return true;">Calculate order price</button>
 </form>

Form works through
the <script>
 $(document).ready(function() {
 $("#php-form-zayvka").submit(function() {
 var form_data = $(this).serialize();
$.ajax({
 type: "POST",
 url: "send.php",
 data: form_data,
 success: function() {
 alert('Your message sent!');
},
 error: function() {
 alert('an error occurred');
}
});
 return false;
});
});

 </script>


Both forms refer to the file send.php
<?php
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$name = htmlspecialchars($name);
$phone = htmlspecialchars($phone);
$email = htmlspecialchars($email);
$name = urldecode($name);
$phone = urldecode($phone);
$email = urldecode($email);
$name = trim($name);
$phone = trim($phone);
$email = trim($email);
//echo $name;
//echo "<br-->";
//echo $phone;
//echo "<br>";
//echo $email;
if (mail("support@1rezultat.kz", "printing", "Name: ".$name." Phone: ".$phone." Email: ".$email ,"From: noreply@rezultat.kz \r\n"))
 { echo "message sent successfully";
} else { 
 echo "when sending message errors occurred";
}?>


And the kicker is that the letter a second form comes with the entered data, and with the first form blank. What could be the problem?

P. S

ID different forms not just the form with id="php-form-zvonok" is used to call the popup . If you swap it in the popup Manager working form stops working. I think the problem lies somewhere in the popup Manager.

Popup Manager
June 10th 19 at 15:59
2 answers
June 10th 19 at 16:01
Solution
Yeah, really strange) it is not in action, you send through ajax.
But it was necessary to start from the next view
var form_data = $(this).serialize();
console.log(form_data);


Second.
The first form to the second.
To try to give different names to these variables.
var form_data1 = $(this).serialize()
var form_data2 = $(this).serialize()


And it does then try to take out specific value out of the required fields, tying them tightly.
So for example
var email = $("form.php-form-zvonok").find( "input[name*='email']" ).val();

And, accordingly, all con and also pass ajax'om
Thank you. I appreciate that you attend to the problem and helped me.

"console.log(form_data); " showed that no data is transmitted.

The solution was change the variables.

When different variables in the line
var form_data1 = $(this).serialize()
var form_data2 = $(this).serialize()

the code works as intended. - Cameron24 commented on June 10th 19 at 16:04
I had suspicions that just don't take the data.
Well, once helped, then great!) - Kamron29 commented on June 10th 19 at 16:07
June 10th 19 at 16:03
Addresses different forms, most likely.
If the forms are the same, why not replace the ID on the class and not to produce a bunch of js
Double quotes do not have to use concatenation, he will understand that it is a variable and what it is
ID different forms not just the form with id="php-form-zvonok" is used to invoke the popup . If you swap it in the popup Manager working form stops working. I think the problem lies somewhere in the popup Manager. - Cameron24 commented on June 10th 19 at 16:06

Find more questions by tags HTMLPHP