Database field mapping with static field add static field with value and map it to database field (Added in v 3.1)

Many times you want to insert some static fixed value in database field along with the other field during database insert operation for example, you want to save logged in user id in the database table (saved in session etc) along with other fields that will be filled by user. User Id needs not to be changed by user and you want to save it's value so you can use this function to add static field value that will be saved in database. Please note that same thing can be done using the callback function also. you can show/hide the field like other static field and it can be viewed using the view source. So if it sensitive information than it will be better to use callback function.

                                $pdocrud = new PDOCrud();
                                // It uses same function formStaticFields that is used to add static fields
                                //first parameter is name of database field to be mapped, 2nd parameter is field type, 3rd parameter is value to be set, 4th parameter needs to be set "db"
                                $pdocrud->formStaticFields("customer_id_field", "hidden", array("33"),"db", "customer_id"); //add hidden field
                                echo $pdocrud->dbTable("ordertable")->render("insertform");

Database field mapping using PDOCrud