public function update() { $id = $_POST[tpl_college::college() . '_' . tpl_college::id() . '_update']; $name = $_POST[tpl_college::college() . '_' . tpl_college::name() . '_update']; $id_university = $_POST[tpl_college::college() . '_' . tpl_college::id_university() . '_update']; $db = new data_base(tpl_college::college(), array(tpl_college::name() => $name, tpl_college::id_university() => $id_university), array(tpl_college::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_college() { $db = new data_base(tpl_college::college(), array(tpl_college::id(), tpl_college::name(), data_base::select_multiple_table(tpl_university::university(), tpl_university::university() . '.' . tpl_university::id(), tpl_college::college() . '.' . tpl_college::id_university(), tpl_university::name(), tpl_university::university() . '_' . tpl_university::name())), array(tpl_college::active() => 1)); echo json_encode($db->get_where()); }
public function get_all_college() { if (isset($_POST['id_university'])) { $id = $_POST['id_university']; if (!empty($id)) { $db = new data_base(tpl_college::college(), array(tpl_college::id(), tpl_college::name()), array(tpl_college::id_university() => $id, tpl_college::active() => 1)); $data = $db->get_where(); $w = ' <option></option>'; foreach ($data as $row) { $w = $w . '<option value="' . $row[tpl_college::id()] . '">' . $row[tpl_college::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_college::college() . '_' . tpl_college::name() . '_update'; ?> "/> </div> <div class="form-group"> <label>country <?php echo tpl_college::college(); ?> : </label> <select name="<?php echo tpl_college::college() . '_' . tpl_college::id_university() . '_update'; ?> " id="<?php echo tpl_college::college() . '_' . tpl_college::id_university() . '_update'; ?> " class="form-control"> <?php $news = new university_lib_ad(); echo $news->select(); ?> </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>