I have multiple pages. On each page I have a list of items. So on Page 1, I have Items 1-10. On page 2, I have items 11-20. It is NOT ten items per page but the point is that page 3 should start off with the number immediately following the last number on page 2.
The pages have a simple numeric variable so the counting of items works fine per page but I want it to be set in one place.
I am brand new to php so my question is mostly about how and where to store a variable that would keep track of this item count over multiple files?
Desired behavior:
Let's say Page 1 has 5 items and my counter variable on page 1 sets them to be correctly numbered to:
1.apple
2.grape
3.pear
4.banana
5.orange
But let's say I need to remove banana. When I do so, the current counter on page 1 works fine and sets to:
1.apple
2.grape
3.pear
4.orange
But on page 2 the counter variable is set to 6 and has:
6.mango
7.peach
8.watermelon
I want to set the persistent variable so that when I remove a fruit, it will update not only the current page the removed fruit is on but every page after that. So it would adjust page 2 to:
5.mango
6.peach
7.watermelon
Would sessions make that change permanent or would it disappear with the user's cookie?