Background:
I have a checkbox form with pagination. I have made so that each time you press the pagination buttons, whether they are next, previous, 1,2,3,4 or last page - they all POST the checkbox value from that specific page that you are on.
The POST value is then set into a SESSION.
All above works fine!
Problem:
Let say I am on page 1 of the pagination, I check one checkbox and that value, lets say the value is "111", is set into both POST and SESSION. Then I click on page 2, check one more checkbox with value "222" and then click on page 3.
Now as soon as I click on the third link, the session value is being overwritten with 222!
What I want is for the array to be 111, 222.
I want to keep the previous value from page 1 and basically just keep adding into the array until I am done, without it being overwritten.
The code is:
if(isset($_POST['bundleAdId']))
$_SESSION['bundleAdId'] = $_POST['bundleAdId'];
I understand that due to the code above, all POST values will be entered over and over again to the session whenever POST is triggered.
But how can I just ADD to the array instead of OVERWRITING?
Aucun commentaire:
Enregistrer un commentaire