chaseman Posted February 27, 2011 Share Posted February 27, 2011 I'm using the PHP Freaks pagination tutorial. Till now the pagination function works very great, except on pages where I use GET in the URL. When I use the pagination navigation links on a profile page like this: domain.com/profile.php?user=konopkov then the URL becomes to this: domain.com/profile.php?current_page=2 And the profile won't show up anymore. So my question is how can I achieve it so the pagination navigation links will still work even with URL's which use GET? Here's an example of the pagination links section: // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?current_page=$next_page'>></a> "; // echo forward link for last page echo " <a href='{$_SERVER['PHP_SELF']}?current_page=$total_pages'>>></a> "; Thank you. Quote Link to comment Share on other sites More sharing options...
chaseman Posted February 27, 2011 Author Share Posted February 27, 2011 This is how I solved it: $url = $_SERVER['PHP_SELF']; $profile = "/directory/profile.php"; $user_name_get = $_GET['user']; if ($url == $profile) { // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?user=$user_name_get¤t_page=$next_page'>></a> "; // echo forward link for last page echo " <a href='{$_SERVER['PHP_SELF']}?user=$user_name_get¤t_page=$total_pages'>>></a> "; } else { // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?current_page=$next_page'>></a> "; // echo forward link for last page echo " <a href='{$_SERVER['PHP_SELF']}?current_page=$total_pages'>>></a> "; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.