It has to be client side, unless you fiddle your "next" and "previous"
buttons to submit forms containing the selection from that page (I
wouldn't do that).
If you are targeting older and newer clients, store the ids in a comma
separated list in a cookie.
If you are only targeting newer clients, use HTML 5 local storage.
When the user finally does hit submit, transfer the list of ids from
the cookie/local storage in to a form field, and handle in the form.
Cheers
Tom