Hi y'all, I'm working with a script for pagination of search results. On the first page it shows the correct amount of results, and it shows the correct number of links (for pages). However, when I go to the next page (or any page as returned by the script) it says there are no search results - basically it did not transfer/keep the search keyword (even though it's url encoded in the link). How do I get the keyword (for the search) to transfer to the next page. How about a good tutorial for pagination. I've looked at a couple and I'm really close to making this work.
Nico_swd, thanks for responding so quickly, but I finally woke up and got over that hurdle. I guess it was the threat of having to post my code (and subsequent embarrassment) that motivated me. =)
$Nav=""; If($page > 1) { $Nav .= "<A HREF=\"search_results.php?page=" . ($page-1) . "&SearchString=" .urlencode($SearchString) . "\"><< Prev</A>"; } For($i = 1 ; $i <= $NumberOfPages ; $i++) { If($i == $page) { $Nav .= "<B>$i</B>"; }Else{ $Nav .= "|<A HREF=\"search_results.php?page=" . $i . "&SearchString=" .urlencode($SearchString) . "\">$i</A>"; } } If($page < $NumberOfPages) { $Nav .= "<A HREF=\"search_results.php?page=" . ($page+1) . "&SearchString=" .urlencode($SearchString) . "\">| Next >></A>"; } Echo "<BR><BR>" . $Nav; Is the search string passed to the next page (and picked up by the script) by the searchstring = ... ? (which seems to me to be what's happening), or is it a global that stays active till the browser is closed? I'm just trying to wrap my head around this. I only ask because I've seen code that doesn't include the searchstring = as part of the url.