public function update()
 {
     $id = $_POST[tpl_companies::companies() . '_' . tpl_companies::id() . '_update'];
     $name = $_POST[tpl_companies::companies() . '_' . tpl_companies::name() . '_update'];
     $id_category = $_POST[tpl_companies::companies() . '_' . tpl_companies::id_category() . '_update'];
     $description = $_POST[tpl_companies::companies() . '_' . tpl_companies::description() . '_update'];
     $mobile = $_POST[tpl_companies::companies() . '_' . tpl_companies::mobile() . '_update'];
     $phone = $_POST[tpl_companies::companies() . '_' . tpl_companies::phone() . '_update'];
     $address = $_POST[tpl_companies::companies() . '_' . tpl_companies::address() . '_update'];
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::name() => $name, tpl_companies::id_category() => $id_category, tpl_companies::description() => $description, tpl_companies::mobile() => $mobile, tpl_companies::phone() => $phone, tpl_companies::address() => $address), array(tpl_companies::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 ajax_companies()
 {
     $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), data_base::select_multiple_table(tpl_category::category(), tpl_category::category() . '.' . tpl_category::id(), tpl_companies::companies() . '.' . tpl_companies::id_category(), tpl_category::name(), tpl_category::category() . '_' . tpl_category::name()), tpl_companies::name()), array(tpl_companies::active() => 1));
     echo json_encode($db->get_where());
 }
 public function get_all_companies()
 {
     if (isset($_POST['id_category'])) {
         $id = $_POST['id_category'];
         if (!empty($id)) {
             $db = new data_base(tpl_companies::companies(), array(tpl_companies::id(), tpl_companies::name()), array(tpl_companies::id_category() => $id, tpl_companies::active() => 1));
             $data = $db->get_where();
             $w = '   <option></option>';
             foreach ($data as $row) {
                 $w = $w . '<option value="' . $row[tpl_specialty::id()] . '">' . $row[tpl_specialty::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'));
     }
 }
?>
"/>
                    </div>


                    <div class="form-group">
                        <label>Category <?php 
echo tpl_companies::companies();
?>
 : </label>
                        <select name="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id_category() . '_update';
?>
"
                                id="<?php 
echo tpl_companies::companies() . '_' . tpl_companies::id_category() . '_update';
?>
"
                                class="form-control">
                            <?php 
$new = new companies_lib_ad();
echo $new->find_category();
?>
                        </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>