public function update() { $id = $_POST[tpl_trainer::trainer() . '_' . tpl_trainer::id() . '_update']; $name = $_POST[tpl_trainer::trainer() . '_' . tpl_trainer::name() . '_update']; $id_companies = $_POST[tpl_trainer::trainer() . '_' . tpl_trainer::id_companies() . '_update']; $id_department = $_POST[tpl_trainer::trainer() . '_' . tpl_trainer::id_department() . '_update']; $id_section = $_POST[tpl_trainer::trainer() . '_' . tpl_trainer::id_section() . '_update']; $db = new data_base(tpl_trainer::trainer(), array(tpl_trainer::name() => $name, tpl_trainer::id_companies() => $id_companies, tpl_trainer::id_department() => $id_department, tpl_trainer::id_section() => $id_section, tpl_trainer::date_in() => date_time::Date_time_24()), array(tpl_trainer::id() => $id)); $results = $db->change(); if ($results) { echo json_encode(array('valid' => 1, 'title' => 'Successfully !!', 'massage' => 'I\'ve been Update ' . $name)); } else { echo json_encode(array('valid' => 0, 'title' => 'Oops !!', 'massage' => 'Was not Update ' . $name . ', please try again')); } }
<table id="table" data-toggle="table" data-url="<?php echo site_url('admin/trainer/ajax_all'); ?> " data-cache="false" data-height="400" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-flat="true" data-toolbar="#toolbar"> <thead> <tr> <th data-field="<?php echo tpl_trainer::id(); ?> " data-halign="center" data-sortable="true"> id</th> <th data-field="<?php echo tpl_trainer::name(); ?> " data-formatter="operate<?php echo tpl_trainer::trainer(); ?> " data-halign="center" data-sortable="true"> name </th> <th data-field="<?php echo tpl_companies::companies() . '_' . tpl_companies::id(); ?> " data-halign="center" data-sortable="true"> companies </th> <th data-field="<?php