pagination number formatting help needed
I have a pagination code that works and works well, but I need to have look like. (it pulls over 5200 records..this is homework)

First <<  1 2 3 4 5 6   >> Last

currently it looks like
1 2 3 4 5 6 7 8 9 10 

 with Previous and Next after 2nd page.  There is also a complication in that I need it to open in a div (currently working).  I just need help getting the numbers formatted correctly.  Any help would be appreciated.


    if ($pages > 1) {
    	echo '<br/><p>';
     
    	$current_page =($start/$display) + 1;
     
    	if ($current_page !=1) {
    		echo '<a href="index.php?menukey='.$_GET['menukey'].'&s=' . ($start - $display) . '&p=' .  $pages .'"> Previous </a>';
    	}
     
    		for ($i = 1; $i <= $pages; $i++) {
    			if ($i != $current_page) {
    				echo '<a href="index.php?menukey='.$_GET['menukey'].'&s=' . (($display * ($i - 1))) . '&p=' . $pages . '">'.' ' . $i . ' '. '</a>';  
    			} else {
    				echo $i . ' ';
    			}
    		}
     
    		if ($current_page != $pages) {
    			echo '<a href ="index.php?menukey='.$_GET['menukey'].'&s=' . ($start + $display) . '&p=' . $pages . '"> Next</a>';
    		}
    		echo '</p>';
    } // endo of links section
    mysqli_free_result($r);
pagination number formatting help needed
===

I have a pagination code that works and works well, but I need to have look like. (it pulls over 5200 records..this is homework)

First <<  1 2 3 4 5 6   >> Last

currently it looks like
1 2 3 4 5 6 7 8 9 10 

 with Previous and Next after 2nd page.  There is also a complication in that I need it to open in a div (currently working).  I just need help getting the numbers formatted correctly.  Any help would be appreciated.


    if ($pages > 1) {
    	echo '<br/><p>';
     
    	$current_page =($start/$display) + 1;
     
    	if ($current_page !=1) {
    		echo '<a href="index.php?menukey='.$_GET['menukey'].'&s=' . ($start - $display) . '&p=' .  $pages .'"> Previous </a>';
    	}
     
    		for ($i = 1; $i <= $pages; $i++) {
    			if ($i != $current_page) {
    				echo '<a href="index.php?menukey='.$_GET['menukey'].'&s=' . (($display * ($i - 1))) . '&p=' . $pages . '">'.' ' . $i . ' '. '</a>';  
    			} else {
    				echo $i . ' ';
    			}
    		}
     
    		if ($current_page != $pages) {
    			echo '<a href ="index.php?menukey='.$_GET['menukey'].'&s=' . ($start + $display) . '&p=' . $pages . '"> Next</a>';
    		}
    		echo '</p>';
    } // endo of links section
    mysqli_free_result($r);