I'm trying to send to a php page a value with the POST method but it doesn't work.
The javascript code is:
function op_infoMeeting(id_met){
$('#modalInfoMeeting').find('.modal-title').text("Info
Meeting");
$('#modalInfoMeeting').modal('show');
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "infoMet.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
xhttp.send(id_met);
return true;
}
The code of infoMet.php is:
<?php
$idMet=$_POST["id_met"];
echo $idMet;
include "DB.php";
$query=mysqli_query($connessione,"select title,date,place from meeting where
meeting_id=".$idMet."");
while($row=mysqli_fetch_array($query,MYSQLI_ASSOC))
{
echo "Staff Name:" . "<input type='text' value='" . $row['name'] . "'>";
echo "</br>";
echo "Contact No.:" . "<input type='text' value='" . $row['title'] .
"'>";
}
?>
It gives me this error:
Undefined index: id_met in infoMet.php on line 4