php - 捕获传递的模态值并将其转换为 php 查询参数
问题描述
编辑:我可以寻求有关此代码的帮助吗?
这是我的模态。我的输入文本收到AAA-123-0001的值
该脚本通过以下方式包含在主页中include()
<input type="hidden" class="decid" id="id" name="id">
<?php include 'includes/services_payslip_list_payslip-selection.php'; ?>
这是我的 services_payslip_list_payslip-selection.php
<script>
$(document).ready(function() {
$("#id").change(function() {
var id = $(this).val();
if(id != "") {
$.ajax({
url:"services_payslip_list-payslip-table.php",
data:{id:id},
type:'POST',
success:function(response) {
var resp = $.trim(response);
$("#id").html(resp);
}
});
}
});
</script>
这是我的 services_payslip_list-payslip-table.php
<table id="example2" class="table table-bordered">
<thead>
<th>Schedule Date</th>
<th>Schedule Name</th>
<th>Recorded In</th>
<th>Recorded Out</th>
<th>Day Count</th>
<th>Day Value</th>
<th>N.D. Value</th>
<th>Leave Count</th>
<th>R.H. Count</th>
<th>R.H. Value</th>
</thead>
<tbody>
<?php
include 'includes/session.php';
if(isset($_POST['id'])) {
$id=$_POST['id']
}
$user = $user['fingerscanno'];
$sql = "SELECT fingerscanno, scheduledate, schedulename, recordin, recordout, noofdays, rate, nightdifferential, leaveday, regularholiday, specialholiday, referenceno
FROM payrollrecords WHERE fingerscanno='$user' and referenceno='$id'";
$query = sqlsrv_query($conn, $sql, array(), array("Scrollable" => SQLSRV_CURSOR_KEYSET));
while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){
echo "
<tr>
<td>".$row['scheduledate']."</td>
<td>".$row['schedulename']."</td>
<td>".$row['recordin']."</td>
<td>".$row['recordout']."</td>
<td>".$row['noofdays']."</td>
<td>".$row['rate']."</td>
<td>".$row['nightdifferential']."</td>
<td>".$row['leaveday']."</td>
<td>".$row['regularholiday']."</td>
<td>".$row['specialholiday']."</td>
</tr>
";
}
?>
</tbody>
</table>
这里似乎有什么问题?services_payslip_list_payslip-selection.php 不会加载到模式中。
解决方案
推荐阅读
- css - 你知道什么可能导致网站的某些部分消失吗?
- java - 在我的情况下,限制对 html 管理页面的访问的最佳方法是什么?
- reactjs - 输入“鼠标事件”
' 不可分配给类型 'boolean' - spring-boot - spring bootrun完成后如何运行spring boot应用程序代码只运行一次
- c# - WPF数据网格显示字符串
- regex - 删除特定字符后的其余行
- db2 - 使用 CLI SQLDriverConnect 的隐式本地连接(无密码)失败并出现 SQL30082N 原因 3 PASSWORD MISSING
- rust - 结构方法作为 FFI 回调
- sql-server - 请帮助进行分组
- css - 车把内联css