calmchess Posted July 16, 2009 Share Posted July 16, 2009 The following script changes pages based on a link being clicked. The forward link works well but the back link doesn't function as exspected...I'm hoping somebody will help me straighten out this script and make it work properly. If you want to execute the script just throw it in a web page and it will execute on my webserver. <html> <head> <title>next page</title> </head> <body> <?php if(isset($_GET['pg'])){ $pnum1 =$_GET['pg']; }else{ $pnum1=0; } if(isset($_GET['rnum'])){ $rnum =$_GET['rnum']+1; }else{ $rnum=0; $pnum = 0; $sp =0; } $pnum =$rnum; $sp = $rnum; if(isset($_GET['rnum'])){ $t1=($rnum-1); if($t1==10){ $rnum=10; } } if(isset($_GET['rnum'])){ $t=($rnum-1-1); if($t==-1){ $t=$t+1; $rnum1 = $rnum-1; echo "self"; echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$rnum1.php?rnum=$rnum&pg=$t;\"><<</a>   $t  "; }else{ $rnum1 = $rnum-1; echo "tracing T ".$t; echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$rnum1.php?rnum=$t&pg=$t\"><<</a>  pg.$t  "; } } if($rnum==0){ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a> "; }else{ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a> "; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/166254-help-with-next-and-previous-page-script/ Share on other sites More sharing options...
calmchess Posted July 16, 2009 Author Share Posted July 16, 2009 here is the solution if anybody is intrested. <html> <head> <title>next page</title> </head> <body> <?php if(isset($_GET['rnum'])){ $rnum =$_GET['rnum']+1; $dis = $rnum-1; $ctrl=0; }else{ $ctrl=0; $rnum=1; $pnum =1; $sp =1; $dis = 0; } if(isset($_GET['pg'])){ $pnum1 =$_GET['pg']; }else{ $pnum1=0; } $pnum =$rnum; $sp = $rnum; if(isset($_GET['rnum'])){ $t1=($rnum-1); if($t1==10){ $rnum=10; } } if(isset($_GET['rnum'])){ $t=($rnum-1-1); if($t==-1){ $t=$t+1; $rnum1 = $rnum-2; $ctrl =1; if($dis ==0){ echo "<a href=\"\"onClick\"return false\"\"><<</a>   pg.$dis  "; }else{ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$pnum1.php?rnum=$rnum&pg=$t\"><<</a>   pg.$dis  "; } }else{ $rnum1 = $rnum-2; echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$rnum1.php?rnum=$t&pg=$t\"><<</a>  pg.$dis  "; } } if($rnum==1 && $ctrl==0){ echo "<a href=\"\" onclick=\"return false\"><<</a> pg.$dis <a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a>"; }else{ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a> "; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/166254-help-with-next-and-previous-page-script/#findComment-876780 Share on other sites More sharing options...
calmchess Posted July 17, 2009 Author Share Posted July 17, 2009 here is some bug fixes. <html> <head> <title>next page</title> </head> <body> <?php if(isset($_GET['rnum'])){ $rnum =$_GET['rnum']+1; $dis = $rnum-1; $ctrl=0; }else{ $ctrl=0; $rnum=1; $pnum =1; $sp =1; $dis = 0; } if(isset($_GET['pg'])){ $pnum1 =$_GET['pg']; }else{ $pnum1=0; } $pnum =$rnum; $sp = $rnum; if(isset($_GET['rnum'])){ $t1=($rnum-1); if($t1==10){ } } if(isset($_GET['rnum'])){ $t=($rnum-1-1); if($t==-1){ $t=$t+1; $rnum1 = $rnum-2; $ctrl =1; if($dis ==0 ){ echo "<a href=\"\"onClick\"return false\"\"><<</a>   pg.$dis  "; }else{ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$pnum1.php?rnum=$rnum&pg=$t\"><<</a>   pg.$dis  "; } }else{ $rnum1 = $rnum-2; echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$rnum1.php?rnum=$t&pg=$t\"><<</a>  pg.$dis  "; } } if($dis==10){ //echo "<a href=\"\" onclick=\"return false\"><<</a> pg.$dis <a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a>"; echo "<a href=\"\" onclick=\"return false\" \">>></a> "; }else{ echo "<a href=\"http://privatechatnow.com/currentwebsite/4pic/next$sp.php?rnum=$rnum&pg=$rnum\">>></a> "; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/166254-help-with-next-and-previous-page-script/#findComment-876825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.