How to Print Post Array In Callback before Insert or Update
- Single Page
Posted 31 July 2012 - 07:26 AM
I Create a Extra Field in My App, And the Field doesn't exist from table in the database,
How I can Get the Value in function Callback before Insert or Update??
My code :
[php]
$crud->fields('roleName','prv_list');
$crud->callback_field('prv_list',array($this,'group_prv_list'));
$crud->callback_before_insert(array($this,'before_insert_update_group_prv_list'));
$crud->callback_before_update(array($this,'before_insert_update_group_prv_list'));
function before_insert_update_group_prv_list($post_array, $primary_key = null) {
if($primary_key !== null) {
//Hot to get value From $post_array to update to Database
}
else {
//Hot to get value From $post_array to Insert to Database
}
return $post_array;
}
[/php]
The prv_list Not In Table of Database, Just a Custom View
And Can we do print_r($post_array) ??
And The View Is
[attachment=241:View_crud.png]
Thanks, And Sorry My English is Very Poor
Posted 01 August 2012 - 03:15 AM
Posted 03 July 2015 - 06:48 AM
same problem here
Posted 03 July 2015 - 09:17 AM
HI! So what the problem? If you do all right then in $post_array look key your input field by it name
O lol, so old post:D