/** * Code for updating the selected links */ } else { if (!empty($_POST) && $_POST['form_action'] == 'update_links') { $link_count = count($_POST['link_id_updated']); $Links = new Links(); $updated_links_count = 0; $Links->user_id = $_SESSION['user']['id']; $Links->category_id = $_POST['category_id']; for ($counter = 0; $counter < $link_count; $counter++) { $Links->title = $_POST['title_updated'][$counter]; $Links->link_id = $_POST['link_id_updated'][$counter]; $Links->url = $_POST['url_updated'][$counter]; try { $Links->update_link(); ++$updated_links_count; } catch (PAException $e) { $message[] = 'Link with title ' . $_POST['title_updated'][$counter] . ' already exists'; } } $json_string = '{ "errors" : "' . uihelper_plural($updated_links_count, ' link') . ' out of ' . $link_count . ' updated successfully,' . implode(",", $message) . '", "updated_category_id" : ' . $_POST['category_id'] . '}'; $message[] = array('category_id' => $_POST['category_id']); array_unshift($message, uihelper_plural($updated_links_count, ' link') . ' out of ' . $link_count . ' updated successfully'); print_r($json_string); /** * Code for displaying the selected links for editing. */ } else { if (!empty($_GET['action']) && $_GET['action'] == 'edit_list_link') { if (!empty($_GET['link_ids'])) {