title: How to retain current current pagination page number when webpage is refreshed?
body: <p>I have simple pagination included in my homepage in order to display the latest news/images  from my server. The pagination is working fine but when i try to move to other page number example page 2, the page loads but after refreshing it goes back again to page 1. I am new to PHP , Ajax and Jquery so I can't figure out where to solve this problem. Here are my codes:</p>
  
  <p>pagination.php</p>
  
  <pre><code>    &lt;?php
  function paginate($reload, $page, $tpages, $adjacents) {
  $prevlabel = "&amp;lsaquo; Prev";
  $nextlabel = "Next &amp;rsaquo;";
  $out = '&lt;div class="pagin page_style"&gt;';
  // previous label
  if($page==1) {
      $out.= "&lt;span&gt;$prevlabel&lt;/span&gt;";
  } else if($page==2) {
      $out.= "&lt;a href='javascript:void(0);' onclick='load(1)'&gt;$prevlabel&lt;/a&gt;";
  }else {
      $out.= "&lt;a href='javascript:void(0);' onclick='load(".($page-1).")'&gt;$prevlabel&lt;/a&gt;";
  
  }   
  // first label
  if($page&gt;($adjacents+1)) {
      $out.= "&lt;a href='javascript:void(0);' onclick='load(1)'&gt;1&lt;/a&gt;";
  }
  // interval
  if($page&gt;($adjacents+2)) {
      $out.= "...\n";
  }
  // pages
  $pmin = ($page&gt;$adjacents) ? ($page-$adjacents) : 1;
  $pmax = ($page&lt;($tpages-$adjacents)) ? ($page+$adjacents) : $tpages;
  for($i=$pmin; $i&lt;=$pmax; $i++) {
      if($i==$page) {
          $out.= "&lt;span class='current'&gt;$i&lt;/span&gt;";
      }else if($i==1) {
          $out.= "&lt;a href='javascript:void(0);' onclick='load(1)'&gt;$i&lt;/a&gt;";
      }else {
          $out.= "&lt;a href='javascript:void(0);' onclick='load(".$i.")'&gt;$i&lt;/a&gt;";
      }
  }
  // interval
  if($page&lt;($tpages-$adjacents-1)) {
      $out.= "...\n";
  }
  // last
  if($page&lt;($tpages-$adjacents)) {
      $out.= "&lt;a href='javascript:void(0);' onclick='load($tpages)'&gt;$tpages&lt;/a&gt;";
  }
  // next
  if($page&lt;$tpages) {
      $out.= "&lt;a href='javascript:void(0);' onclick='load(".($page+1).")'&gt;$nextlabel&lt;/a&gt;";
  }else {
      $out.= "&lt;span&gt;$nextlabel&lt;/span&gt;";
  }
  $out.= "&lt;/div&gt;";
  return $out;
  }
  ?&gt;
  </code></pre>
  
  <p>/////////////////////////////////////////</p>
  
  <p>Home.php</p>
  
  <pre><code>        &lt;?php session_start(); ?&gt;
      &lt;?php 
      $action = (isset($_REQUEST['action'])&amp;&amp; $_REQUEST['action'] !=NULL)?$_REQUEST['action']:'';
      if($action == 'ajax'){
      /* Connect To Database*/
      $dbname = 'banaue.com';
      $link = mysql_connect("localhost","root","") or die("Couldn't make connection.");
      $db = mysql_select_db($dbname, $link) or die("Couldn't select database");
  
      include 'pagination.php'; //include pagination file
      //pagination variables
      $page = (isset($_REQUEST['page']) &amp;&amp; !empty($_REQUEST['page']))?$_REQUEST['page']:1;
      $per_page = 1; //how many records you want to show
      $adjacents  = 5; //gap between pages after number of adjacents
      $offset = ($page - 1) * $per_page;
      //Count the total number of row in your table*/
      $count_query   = mysql_query("SELECT COUNT(title) AS numrows FROM news");
      $row     = mysql_fetch_array($count_query);
      $numrows = $row['numrows'];
      $total_pages = ceil($numrows/$per_page);
      $reload = 'Home.php';
      //main query to fetch the data
      $result = mysql_query("SELECT * FROM news ORDER BY date_posted LIMIT $offset,$per_page");
      //loop through fetched data
  while($test = mysql_fetch_array($result)){
  
      $id = $test['title'];   
      echo "&lt;div class='content' stye=margin-bottom: 20px;&gt;";
      echo'&lt;div class="img_content" &gt;&lt;img src='.$test['img_path'].' style=height:520px;width:100%;&gt;&lt;/div&gt;';
                  echo"&lt;p class=para_news2 style=margin-left:10px;&gt;&lt;font color='#336699'&gt;" .$test['title']."&lt;/p&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;";
                  echo"&lt;p class=para_news4 style=margin-left:10px;width:100%;&gt;&lt;img src='images/user.gif'&gt;&amp;nbspStory By: &lt;font color='lavander'&gt;" .$test['author']."&lt;/font&gt;&lt;/p&gt;";
                  echo"&lt;p class=para_news4 style=margin-left:10px;width:100%;&gt;&lt;img src='images/calendar.gif'&gt;&amp;nbspDate Posted: &lt;font color='red'&gt;". $test['date_posted']. "&lt;/font&gt;&lt;/p&gt;";
                  echo"&lt;p class=para_news3 style=margin-left:10px;width:100%;&gt;&lt;img src='images/comments.gif'&gt;&amp;nbsp&lt;font color='black'&gt;". $test['intro']. "&lt;/font&gt;&lt;/p&gt;&lt;br&gt;";
                  echo"&lt;a href ='news.php?title=$id'&gt;&lt;font style='float:right;margin-right:10px;background:url(images/bg_header.jpg);padding:2px;'&gt;Read more ...&lt;/a&gt;&lt;br&gt;";
      echo        "&lt;/div&gt;";
  }
  echo paginate($reload, $page, $total_pages, $adjacents);
  
  } else{
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;head&gt;&lt;!-- Head declaration --&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          load(1);
      });
      function load(page){
          $("#loader").fadeIn('slow');
          $.ajax({
              url:'Home.php?action=ajax&amp;page='+page,
              success:function(data){
                  $(".outer_div").html(data).fadeIn('slow');
                  $("#loader").fadeOut('slow');
              }
          })
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;!-- Body Content --&gt;
  &lt;div class="main_body" style="height:auto;"&gt;
  &lt;!-- Top Stories Query--&gt;
  &lt;div class="outer_div"&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php }?&gt;
  </code></pre>
  
  <p>Please help me with this problem so that i can move on....</p>