You are seeing this very light version of the page, as you are using an outdated
browser!
Onlinetools.org is done in XHTML 1.0 and supports CSS 2.0, please upgrade your
browser if you want a better version of this site.
Thank you, please help us developers keep up with the industry rather than patching our code for outdated applications.
"Previous" and "next" links are one of the necessary evils any middleware developer has to script sooner or later.
Whenever you display a lot of elements of a list, like news, entries in a guestbook, or search results, it's a good idea to limit the displayed items to a certain number per page.
Not only to avoid long rendering times, but also to make it easier for the user to scan for his desired item and to prevent scrolling.
Ok, we need them, let's do them. First thing you do is to analyse the logic behind "previous" and "next" links.
There are loads of solutions for this issue, most of them using a lot of "if" and "else" statements. Especially displaying the elements while making sure that there are still some, and checking that the start of the "next" link does not exceed the number of available elements can be quite a headache.
Unless you use some of the beautiful functions of PHP that do almost all the necessary comparisons for you.
Table of contents:
The issue with Previous and Next links
PHP to the rescue
The whole script