在这里,我有带有复选框的树视图。我的问题是如何为选中的复选框设置等于“y”的条件,如果未选中的复选框等于“n”。我必须在数据库中更新 chekbox 的值,该值是活动列,包含两个值,即“y”和“n”。我在 javaScript 中使用 AJAX。应该选中复选框将获得“y”,未选中复选框将在数据库中获得“n”。但现在,我目前只是在数据库中保存等于“y”的复选框。任何人都有建议,最好的方法是什么?供您参考,我正在使用 treeview Kendo UI。
更新.php
function deleteTemplate(){
global $ehorsObj;
$employeeID = $_SESSION['employeeID'];
$propertyID = $_SESSION['propertyID'];
$id = (isset($_POST['id']) ? $_POST['id'] : '');
$progid = (isset($_POST['progid']) ? $_POST['progid'] : '');
$sqlDelete = "DELETE FROM tblHrsPositionProgramTemplate
WHERE hrsPositionID = '".$id."'";
$ehorsObj->ExecuteData($sqlDelete, $ehorsObj->DEFAULT_PDO_CONNECTIONS);
for($x=0; $x< sizeof($progid); $x++ )
{
$positionTemplateID = $ehorsObj->EHORS_PK("tblHrsPositionProgramTemplate");
$sqlAdd = "INSERT INTO tblHrsPositionProgramTemplate
SET positionTemplateID = '" . $positionTemplateID . "',
programID = '" . $progid[$x] . "',
hrsPositionID = '" . $id . "',
propertyID = '" . $propertyID . "',
employeeID = '" . $employeeID . "',
dateTimeEmployee = NOW() ";
$ehorsObj->ExecuteData($sqlAdd, $ehorsObj->DEFAULT_PDO_CONNECTIONS);
$positionTemplateIDLog = $ehorsObj->EHORS_PK("tblHrsPositionProgramTemplateLog");
$sqlAddLog = "INSERT INTO tblHrsPositionProgramTemplateLog
SET positionTemplateIDLog = '" . $positionTemplateIDLog . "',
positionTemplateID = '" . $positionTemplateID . "',
programID = '" . $progid[$x] . "',
hrsPositionID = '" . $id . "',
propertyID = '" . $propertyID . "',
employeeID = '" . $employeeID . "',
dateTimeEmployee = NOW() ";
$ehorsObj->ExecuteData($sqlAddLog, $ehorsObj->DEFAULT_PDO_CONNECTIONS);
}}
素胚勾勒不出你