表格加载
$('#searchVehicleDesc').button().click(function (e) {
e.preventDefault();
$('#vehicleLogsTable').jtable('load', {
plate: $('input[name=vehicle_service_search]').val(),
date1: $('input[name=searchDate1]').val(),
date2: $('input[name=searchDate2]').val()
});
PHP
<?PHP
include("db.classes.php");
$g = new DB();
$g->connection();
$term ="";
$d1 ="";
$d2 = "";
if(isset($_POST['plate']) && isset($_POST['date1']) && isset($_POST['date2']))
{
$term = $_POST["plate"];
$da1 = $_POST["date1"];
$da2 = $_POST["date2"];
$g->getAllDesc($term, $da1, $da2);
}
else
{
// line 20 $term = $_POST["plate"];
// line 21 $d1 = $_POST["date1"];
// line 22 $d2 = $_POST["date2"];
$g->getAllDesc($term, $d1, $d2);
}
$g->close();
?>
我需要传递三个数据来查询它,但我在 20,21,22 行中出现未定义索引错误,这里看起来有什么问题?
答案 0 :(得分:0)
先尝试检查
$term = isset($_POST["plate"]) && !empty($_POST["plate"]) ? $_POST["plate"] : null;
现在如果帖子没有这些字段,你就不会遇到错误