PHP - How to create next botton - Asked By Olusegun A. on 07-Aug-10 01:06 PM

Hello friends, I have list of items(products) in my database, and i echo them on my catalogue page, when you click on an item you will have to come back to the catelogue page before you can click on the next item. pls how do i script a link (NEXT or PREVIOUS) so that when the visitor can click on NEXT botton in order to see the detail of the next item without first going back to the catelogue page? (Eg when reading a message in your Yahoo, Gmail or Hotmail inbox, you can move to the next message by clicking on next without going back to your INBOX).

Pls I need the syntax.

Super Man replied to Olusegun A. on 07-Aug-10 01:31 PM
 $limit = 3; // No of files wanted to show per page
 $the_array = Array(); 
 while (false !== ($file = readdir($handle))) 
   if ($file != "." && $file != ".."
     $the_array[] = $file
 rsort($the_array, SORT_NUMERIC); 
  $totalrows  = count($the_array); 
  echo("<p> Total number of files $totalrows </p>");
    $page = 1; 
  $limitvalue = $page * $limit - ($limit); 
  if ($the_array == NULL) 
    print ("<center><img src=\"img/construction.gif\"><br /><b>Denne seksjonen holder på å bli oppdatert</b></center>");
    for($i = $limitvalue; $i < ($page * $limit); $i++) 
      include ("vask/".$the_array[$i]);  
      echo "vask/".$the_array[$i]."<br>";//just to show file names
  if($page != 1)
    $pageprev = $page-1; 
    echo("<a href='paging_test.php?page=$pageprev'>PREV</a> "); //paging_test.php is the php file name I tested. edit this name with ur own file name.
   echo "   ";    // Gap between prev and next
  if(($totalrows - ($limit * $page)) > 0)
    $page = ($page+1); 
    $pagenext = $page
    echo("<a href='paging_test.php?page=$pagenext'>NEXT</a>");