Как мне удается получать вводимые пользователем данные внутри текстового поля? Ниже я имею в виду более подробно:
my JS выглядит так:
$('#sad').on('click', function() {
const sad = $('#sad').val();
const { value: text } = Swal.fire({
title:'<strong>Lass uns mehr erfahren</strong>',
input: 'textarea'
}).then(function() {
$.ajax({
type: "POST",
url: "feedback.php",//===PHP file name and directory====
data:{sad: sad},
success:function(data){
console.log(data);
//Success Message == 'Title', 'Message body', Last one leave as it is
Swal.fire({
icon: 'success',
title: "Danke!",
showConfirmButton: false,
timer: 3000
});
},
error:function(data){
//Error Message == 'Title', 'Message body', Last one leave as it is
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Something went wrong!'
})
}
});
if (text) {
$.ajax({
type: "POST",
url: "feedback.php",
data: {'text': text}
})
}
})
})
и my PHP:
$sad = $_POST['sad'];
$text = $_POST['text'];
elseif(isset( $_POST['sad'] )) {
$EmailFrom = "xxxxxxxx@gmail.com";
$Subject = "New Feedback";
$mailTo = "info@xxxxxxxx.me";
$txt = "Oh no, you got a new 'Sad' review".$text;
$headers = 'From: ' .$EmailFrom. "\r\n";
mail($mailTo, $Subject, $txt, $headers);
header("Location: https://xxxxxxxx.me/?mailsend");
}
Я получаю часть $ txt, но не пользовательский ввод по электронной почте: «О нет, у вас есть новый« грустный »обзор»