pagination previous and next links to retrieve from form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Simplecat
Forum Newbie
Posts: 11
Joined: Wed Aug 24, 2005 6:27 am

pagination previous and next links to retrieve from form

Post by Simplecat »

Hi

I have been having trouble using pagination to display user searches from a form. The user can enter search parameters with the following three criteria: pricerange, location and property_type from drop down menu's on a html page. when submitted these are sent to a php page. The first page of results is OK, showing the required results, but when using the next and previoius links the results seem to be unfiltered. Seems that the pagination script loses the original search criteria. and just scrolls through the table. I know the script is basically OK

Could anyone tell me if the below code snippet used for printing out the previous link would rectify this


if($page > 1){
$prev = ($page - 1);

echo '<a href="'.$_SERVER['PHP_SELF'].'?page=' .$prev. '&pricerange='.$_GET['pricerange'].'&location='.$_GET['location'].'&property_type='.$_GET['property_type'].'">prev</a>';

}

Am getting desparate now... this pagination thing is a bugger

Cheers

Simplecat
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Not enough code to say. As the user is using a <form> it could aswell be using the $_POST way of retreiving data.... It looks allright though if it's indeed using the $_GET and URI way of shipping formdata.
Post Reply