For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > January 2005 > Pager and Cookies









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Pager and Cookies
Andrew Nagy

2005-01-26, 8:56 pm

I am implementing cookies with my paged application so that I can come
back to the list without loosing my place. Basically the page number is
stored in the cookie. However I am experiencing some strange results.

My application is working fine as I page through the results, however
the list of pages is showing that I am on the previous page (obviously
because I have a cookie with the same name as the page variable).

Is their a way that I can specify the page I am on instead of pager
determining this for me with the $_REQUEST variable, or can the pager
code be modified as to not use the $_REQUEST variable but to use the
following if statement?

if (isset($_POST[$pageId])) {
...
} elseif (isset($_GET[$pageId])) {
...
} elseif (isset($_COOKIE[$pageId])) {
...
}

This will allow the use of cookies in conjunction with either a GET or
POST page value.

Is this the best way, or am I missing something?

Thanks
Andrew
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com