izlik Posted November 18, 2007 Share Posted November 18, 2007 hello, this code http://nopaste.php-quake.net/9687 it's a tag system and on the bottom of the page there is a "next" to shift page if there is more then 30 images in total for the tag a user pressed. if i however have the tag "tags.php?=games" and press "next" it becomes "tags.php?pagenum=2" and everyting becomes messed up, do anyone know why? and could help me some this problem? :/ i cant get my head around it. Quote Link to comment Share on other sites More sharing options...
only one Posted November 18, 2007 Share Posted November 18, 2007 Why do you want to add '?=games' to the querystring? It wont do anything. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 18, 2007 Share Posted November 18, 2007 You need to be passing the tag variable in the URL in all of your pagiation links - each time the page loads, it searches the database dependant on that variable, so it is always needed. You need to make your links like: echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; You'll need to change all the other links to also pass tag in the URL. Quote Link to comment Share on other sites More sharing options...
only one Posted November 18, 2007 Share Posted November 18, 2007 echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; That wont be valid HTML.. echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; Quote Link to comment Share on other sites More sharing options...
izlik Posted November 18, 2007 Author Share Posted November 18, 2007 Hey again. i added in what you said into the code so it looks like bellow, but when i now press "next" it will reload the page on page 1 al lthe time and not go to 2 or 3 "/tags.php?pagenum=2&tag=" <-- resault i get in the browser, no tag :/ <? echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&tag={$_GET['tag']}'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&tag={$_GET['tag']}'> <-Previous</a> "; } //just a spacer echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&tag={$_GET['tag']}'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&tag={$_GET['tag']}'>Last ->></a> "; } ?> Quote Link to comment Share on other sites More sharing options...
izlik Posted November 19, 2007 Author Share Posted November 19, 2007 anyone around still that think they could help out? :/ i would be very very much greatfull 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.