分页下降

I want to add dropdown in pagination so that if there is more then 10 pages it will be stored in dropdown so that any one can select any page from it.

Here is my php code which show this output: 1 2 3 4 5 6 7 8 9 10 11........... 100

$sql = "SELECT * FROM `new_data`"; 
$rs_result = mysqli_query($con,$sql); 
$total_records = mysqli_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page); 

echo "<a href='View.php?page=1'>".'|<'."</a> "; // Goto 1st page  

for ($i=1; $i<=$total_pages; $i++) { 
        echo "&nbsp;<a href='View.php?page=".$i."'>".$i."</a> "; 
}; 
echo "&nbsp;<a href='View.php?page=$total_pages'>".'>|'."</a> ";//Goto last page

Output i want : 1 2 3 4 5 6 7 8 9 10 dropdown(contains all pages 11 to 100)

I done it with php using your php code. Here is my code:

$sql = "SELECT * FROM `new_data`"; 
$rs_result = mysqli_query($con,$sql); //run the query
$total_records = mysqli_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page); 

echo "<a  href='View.php?page=1'>".'FIRST <<'."</a> "; // Goto 1st page  

for ($i=1; $i<=$total_pages; $i++) 
  { 
    if($total_pages<=10)
       {
         echo "&nbsp;<a style='color:#333;' href='View.php?page=".$i."'>".$i."</a> "; 
       }
else
{
    for ($i=1; $i<=10; $i++) 
     { 
        echo "&nbsp;<a style='color:#333;' href="View.php?page=".$i."'>".$i."</a> "; 
     };
    echo "<select class='mySelectBox' onchange='location = this.options[this.selectedIndex].value;'>";
     for ($i=11; $i<=$total_pages; $i++) 
     { 
            echo "<option value= View.php?page=".$i.">".$i."</option>";
     };
      echo "</select>";
}
}; 
echo "&nbsp;<a href='View.php?page=$total_pages'>".'........>> LAST'."</a> "; // Goto last page
$sql = "SELECT * FROM `new_data`"; 
$rs_result = mysqli_query($con,$sql); 
$total_records = mysqli_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page); 

echo "<a href='View.php?page=1'>".'|<'."</a> "; // Goto 1st page  
$array = [];
for ($i=1; $i<=$total_pages; $i++) { 
        $array[$i] = "<a href='View.php?page=".$i."'>".$i."</a>"; 
}; 
echo "&nbsp;<a href='View.php?page=$total_pages'>".'>|'."</a> ";//Goto last page

Add all the page informations in array and then later populate the dropdown with an array I have changed the for loop code only ... you just popultae your dropdown with the $array;