In case you've missed it, you are looking at an older version of the website. Checkout our latest version, we promise you will love it 😍

add_fields

void add_fields( array $var  )
Quick Description: The fields that user will see on add operation

The fields that user will see when the insert form opens.

At the below example we can see that the insert form has more values than the edit form.

 
function customers_example() {
    $crud = new grocery_CRUD();
 
    $crud->set_table('customers')
        ->set_subject('Customer')
        ->columns('customerName','contactLastName','creditLimit');
 
    $crud->add_fields(array('customerName','contactLastName','city','creditLimit'));
    $crud->edit_fields(array('customerName','contactLastName','city'));
 
    $crud->required_fields(array('customerName','contactLastName'));
 
    $output = $crud->render();
 
    $this->_example_output($output);
}
 

So at the example we can simply add the creditLimit only when we insert. At the edit_fields the field "creditLimit" is missing. So the user can't actually edit the creditLimit at the update form.