Selection of number of records per page by the user in php paging script
Users can select the number of records they want to see per page in the paging script. This customization of the existing paging script can be done by using a drop down box and visitors can select the value for number of records per page. Once this value is selected the value is to be carried to all subsequent pages of paging script. We will be using the query string to pass the value of number of records per page by adding the name value payer to the links at the bottom.
Note that when the page first opens there is no selection for the number of records per pages so we have given a default value of 10 to this. Any point of time if the user gives the selection for number of records from the drop down list box then the data will be submitted to the first page only. This way we can ensure that any change always starts from first page only.
If you don't want this to happen and once the visitor is changing number of records the page should start from current page itself ( without going to first page ) then you have to add the value of start within the form by using one hidden tag.
<input type=hidden name=start value=$start>
This is also explained in the downloaded demo file.
Demo of paging script with User selection ( records per page) by dropdown list
Be the first to post comment on this article :