R
riajul74 author
list select field, its value becomes $arr accepting only 2 values If I select more then 2 values from the list "emp_number" then it showing Error
<<< Record was NOT added >>> Column 'emp_number' cannot be null
Back to list
if ($values["emp_number"])
{
$arr = explode(",",$values["emp_number"]);
// This is the name of the multi check box or
// list select field, its value becomes $arr
for ($i=0;$i<count($arr);$i++)
{
$strInsert = "insert into hrm_leave_entitlement (emp_number,no_of_days,
days_used,
leave_type_id,
from_date,
to_date,
credited_date,
note,
entitlement_type,
deleted,
created_by_id,
created_by_name
) values ('".$arr[$i]."',
'".$values["no_of_days"]."',
'".$values["days_used"]."',
'".$values["leave_type_id"]."',
'".$values["from_date"]."',
'".$values["to_date"]."',
'".$values["credited_date"]."',
'".$values["note"]."',
'".$values["entitlement_type"]."',
'".$values["deleted"]."',
'".$values["created_by_id"]."',
'".$values["created_by_name"]."')";
// add more fields from the add page to be inserted into database
db_exec($strInsert);
}
// Exit and Redirect to the list page after updating database
exit();
} // Place event code here.
// Use "Add Action" button to add code snippets. return true;
;
|
|