我尝试使用POST方法向php页面发送值,但它无法正常工作。
javascript代码为:
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;
}
infoMet.php的代码是:
<?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'] .
"'>";
}
?>
它给了我这个错误:
未定义的索引:第4行的infoMet.php中的id_met