public function update()
 {
     $id = $_POST[tpl_section::section() . '_' . tpl_section::id() . '_update'];
     $name = $_POST[tpl_section::section() . '_' . tpl_section::name() . '_update'];
     $id_department = $_POST[tpl_section::section() . '_' . tpl_section::id_department() . '_update'];
     $db = new data_base(tpl_section::section(), array(tpl_section::name() => $name, tpl_section::id_department() => $id_department), array(tpl_section::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'));
     }
 }
 public function find_section()
 {
     if (isset($_POST[tpl_department::id() . "_" . tpl_department::department()])) {
         $id = $_POST[tpl_department::id() . "_" . tpl_department::department()];
         if (!empty($_POST[tpl_department::id() . "_" . tpl_department::department()])) {
             $db = new data_base(tpl_section::section(), array(tpl_section::id(), tpl_section::name()), array(tpl_section::active() => 1, tpl_section::id_department() => $id));
             $data = $db->get_where();
             $w = '<option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_section::id()] . '">' . $row[tpl_section::name()] . '</option>';
             }
             echo $w;
         } else {
             echo 'error';
             die;
         }
     } else {
         echo 'error';
         die;
     }
 }
 public function get_all_section()
 {
     if (isset($_POST['id_department'])) {
         $id = $_POST['id_department'];
         if (!empty($id)) {
             $db = new data_base(tpl_section::section(), array(tpl_section::id(), tpl_section::name()), array(tpl_section::id_department() => $id, tpl_section::active() => 1));
             $data = $db->get_where();
             $w = '   <option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_department::id()] . '">' . $row[tpl_department::name()] . '</option>';
             }
             echo $w;
         } else {
             echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error empty'));
         }
     } else {
         echo json_encode(array('valid' => false, 'title' => 'Oops !!', 'massage' => 'error isset'));
     }
 }
echo tpl_section::section() . '_' . tpl_section::name() . '_update';
?>
"/>
                    </div>

                    <div class="form-group">
                        <label>department <?php 
echo tpl_section::section();
?>
 : </label>
                        <select name="<?php 
echo tpl_section::section() . '_' . tpl_section::id_department() . '_update';
?>
"
                                id="<?php 
echo tpl_section::section() . '_' . tpl_section::id_department() . '_update';
?>
"
                                class="form-control">
                            <?php 
$new = new section_lib_ad();
echo $new->find_department();
?>
                        </select>
                    </div>

                    <button type="submit" class="btn btn-success" id="update" name="update">Save</button>
                </form>
                </br>
                </br>
                <div class="" id="result_massages_update"></div>