How can I pass an array of randomized elements through back and next button without repeatation?
Feb 26th, 2008 23:57
dman, Daniel O, Ayse Geertsma, nickhee wong, http://www.ttnr.org
You can keep all your data in any page with a session. Feed the
session_id by cookie or by URL (yes, I know, you still need to pass on
a variable but bare with me here).
Now you don't want to pass all the elements one by one into you session
but you want to pass the array at once. You can use implode() and
explode() to convert the array to a string.
Okay, this doesn't save all kinds of arrays but I think you should
write a class for that or something.
Another thing that you might want to think of doing is creating a
session cookie as before. Have this cookie store the pages that the
user has been to. Then you write a function that reads what URLs are
already there, takes the array that you feed it, compares the data in
the cookie against the array, and then copies the given array into a new
array, with only unique elements. It would be similar to creating a
random ad, only you would create a new array to store the unique elements.