View Full Version : checkbox pagination

10-06-2008, 11:21 PM
I have pagination in the page. The problem I have is, I will loose the status of the checkbox when I go to second page. If I select some of the checkboxes in page 1 and go to page 2 to select some more and if I come back, I loose all the selected checkboxes in page 1.
Is there a way where I could save my check boxes in session and its checked while I browse across pages and gets submitted all at once? Could you please help me?

10-07-2008, 12:18 AM
Yes, it is possible.

You can store the values of your checkboxes in an array, serialize the array and store it in a session. Then, when you return to page 1 (for example), you unserialize the session variable and use the values in the array to repopulate your checkboxes.

When you submit, you would again unserialize the array and process the values from the checkboxes.

10-09-2008, 10:20 PM
how to serialize and unserialize the array?

10-09-2008, 10:39 PM
serialize (http://www.php.net/manual/en/function.serialize.php) and unserialize (http://www.php.net/manual/en/function.unserialize.php)