I am having pagination with PHP, and am having next and previous page SUBMIT buttons, hence if the user checks 2 values on page 1, I store it in a session variable, and when he visits back I use `in_array` and echo out the value. but how do I unset the value in array if the user unchecks? am not able to unset the value in session array if user has unchecked the checkbox.

I guess my explanation is crystal clear but still if some needs the code than here it is

```
if(!empty($_POST['rec_num'])) {
        if(empty($_SESSION['checks_selected_for_records'])) {
               //If session array is empty than directly add all record numbers in
               //this session
           $_SESSION['checks_selected_for_records'] = $_POST['rec_num'];
       }
        //If a new value is seen and is not in array than add it            
       foreach ($_POST['rec_num'] as $check_rec_num) {
        if(!in_array($check_rec_num, $_SESSION['checks_selected_for_records'])) {
           array_push($_SESSION['checks_selected_for_records'], $check_rec_num);
       }
   }
} 

//Handle Redirects For Pagination
if (isset($_POST['next_page']) || isset($_POST['last_page']) || isset($_POST['first_page']) || isset($_POST['previous_page'])) {
        if(isset($_POST['next_page_link'])) {
            redirect_to($_POST['next_page_link']);
        } elseif (isset($_POST['last_page'])) {
            redirect_to($_POST['last_page_link']);
        } elseif (isset($_POST['first_page'])) {
            redirect_to($_POST['first_page_link']);
        } elseif (isset($_POST['previous_page'])) {
            redirect_to($_POST['previous_page_link']);
        }
    }

```