title: How to paginate the filtered results in php mysql?
body: <p>How to paginate the filtered results in php mysql?</p>
  
  <p>My pagination displays only all files that is stored in database but when I want to search for example, all records of remarks interviewed, it will display all files having remarks interviewed, then in 2nd page it still displays the filtered results.</p>
  
  <p>My problem is when I click the pagination, the second page will retrieve again all files that is stored in database. I want the second page is the filtered results.</p>
  
  <pre><code>    `&lt;?php 
      include 'functions.php';
      ob_start();
  
      if(!loggedin())
      { header("Location:login.php");
      exit();
       }
  
      if(isset($_POST['edit']))
       {
  
      $_SESSION['id']=$_POST['id'];
       header("Location:edit.php");
      }
  
       if(isset($_POST['BOOK']))
          {
      $_SESSION['id']=$_POST['id'];
      header("Location:booking_edit.php");}
  
  
          if($_POST['types'] == 'name' || $_POST['types'] == 'mobile' || $_POST['types'] ==       'OccasionType')
      {
      $_SESSION['filter']=$_POST['filter'];
       }
  
       ?&gt;
       &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html&gt;
       &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;
       &lt;title&gt;Manorama Party Plot&lt;/title&gt;
        &lt;link href="css/style.css" rel="stylesheet" type="text/css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/flexigrid.css" media="all" /&gt;
  
      &lt;script type="text/javascript" src="js/prototype.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="js/jquery.min.js"&gt;&lt;/script&gt;
  
          &lt;script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"&gt;           &lt;/script&gt;
  
          &lt;script type="text/javascript"&gt;
      $(function(){
  
      // Datepicker
          $('#From,#To').datepicker({
      inline: true
      });
  
                  //hover states on the static widgets
                  $('#dialog_link, ul#icons li').hover(
                      function() { $(this).addClass('ui-state-hover'); }, 
                      function() { $(this).removeClass('ui-state-hover'); }
                  );
  
              });
          &lt;/script&gt;        
          &lt;script type="text/javascript"&gt;     
         $(document).ready(function() {     
         $('#types').change(function(){     
        if($('#types').val() === 'InquiryDate' || $('#types').val() === 'OccasionDate')     
       {     
       $('#From').show();
        $('#To').show(); 
        $('#filter').hide();     
       }     
        else    
       {
      $('#filter').show();         
       $('#From').hide();
       $('#To').hide();        
       }     
        });     
       });     
        &lt;/script&gt; 
  
  
        &lt;script type="text/javascript" src="js/flexigrid.js"&gt;&lt;/script&gt;
  
  
       &lt;/head&gt;
       &lt;body&gt;
  
  
  
        &lt;div class="wrapper filter_wrapper"&gt;
       &lt;div id="header"&gt;
         &lt;?php include 'header.php'; ?&gt;
      &lt;/div&gt;
      &lt;div id="content"&gt;&lt;/div&gt;&lt;/div&gt;
      &lt;div class="fillter_con"&gt;
       &lt;div class="flexigrid fillter"&gt;
               &lt;div class="pDiv"&gt;
                  &lt;div class="pDiv2 axport"&gt;
                  &lt;h2&gt;Filter :&lt;/h2&gt;  
  
  
  
         &lt;form action='&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;' method='post' name='form_filter'&gt; 
         &lt;select class="filter_select" id="types" name="types"&gt;
                  &lt;option value="none"&gt;none&lt;/option&gt;
                      &lt;option value="name"&gt;name&lt;/option&gt; 
                      &lt;option value="mobile"&gt;mobile&lt;/option&gt; 
                      &lt;option value="OccasionType"&gt;OccasionType&lt;/option&gt;
                      &lt;option value="InquiryDate"&gt;InquiryDate&lt;/option&gt;
                      &lt;option value="OccasionDate"&gt;OccasionDate&lt;/option&gt; 
               &lt;/select&gt; 
                &lt;input class="filter_input" name="filter" id="filter" type="text" &gt; 
            &lt;input type="text" class="filter_input" id="From" name="From" style="display:  none;" va  lue="From" onblur="this.value==''?this.value='From':this.value=this.value"  onfocus="this.value=='From'?this.value='':this.value=this.value" /&gt; 
            &lt;input type="text" class="filter_input" id="To" name="To" style="display: none;" value="To" onblur="this.value==''?this.value='To':this.value=this.value" onfocus="this.value=='To'?this.value='':this.value=this.value" /&gt;  
                    &lt;input class="filter_button" type='submit' value = 'Go'&gt; 
                  &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;?php
  
          $tbl_name="visitor_detail"; $adjacents = 3;
  
      if($_POST['types'] == 'name') {  
      $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE    name='".$_SESSION['filter']."' ORDER BY id DESC";
      }  
         elseif($_POST['types'] == 'mobile') { 
        $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE mobile='".$_SESSION['filter']."' ORDER BY id DESC";
      } 
         elseif($_POST['types'] == 'OccasionType') {  
       $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE OccasionType='".$_SESSION['filter']."' ORDER BY id DESC";
       } 
  
         elseif($_POST['types'] == 'InquiryDate') { 
         $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE TodayDate between '".$_POST['From']."' and '".$_POST['To']."' ORDER BY id DESC"; 
         }
  
         elseif($_POST['types'] == 'OccasionDate') {  
           $query = "SELECT COUNT(*) as num FROM $tbl_name WHERE date between '".$_POST['From']."' and '".$_POST['To']."' ORDER BY id DESC";
           }
  
      else { 
           $query = "SELECT COUNT(*) as num FROM $tbl_name ORDER BY id DESC";
      }
  
      $total_pages = mysql_fetch_array(mysql_query($query));
      $total_pages = $total_pages['num'];
  
      /* Setup vars for query. */
      $targetpage = "all_inquiry.php";    //your file name  (the name of this file)
      $limit = 10;
  
       $page = $_GET['page'];
  
      if($page) 
          $start = ($page - 1) * $limit;          //first item to display on       this page
      else
          $start = 0;                             //if no page var is given, set start to 0
  
  
  
       if($_POST['types'] == 'name') {  
  
        $que = "SELECT * FROM visitor_detail WHERE name='".$_SESSION['filter']."' ORDER BY id   DESC LIMIT $start, $limit";  
         }  
        elseif($_POST['types'] == 'mobile') {  
  
         $que = "SELECT * FROM visitor_detail WHERE mobile='".$_SESSION['filter']."' ORDER BY id  DESC LIMIT $start, $limit ";  
        } 
         elseif($_POST['types'] == 'OccasionType') {  
  
        $que = "SELECT * FROM visitor_detail WHERE OccasionType='".$_SESSION['filter']."'   ORDER BY id DESC LIMIT $start, $limit";  
         } 
  
        elseif($_POST['types'] == 'InquiryDate') {  
        $que="SELECT * FROM visitor_detail WHERE TodayDate between '".$_POST['From']."' and   '".$_POST['To']."' ORDER BY id DESC LIMIT $start, $limit" ;  
       }
  
         elseif($_POST['types'] == 'OccasionDate') {  
        $que="SELECT * FROM visitor_detail WHERE date between '".$_POST['From']."' and '".$_POST['To']."' ORDER BY id DESC LIMIT $start, $limit" ;  
       }
  
         else {  
         $que = "SELECT * FROM visitor_detail ORDER BY id DESC LIMIT $start, $limit";  
      } 
  
        $sql = mysql_query($que);
  
  
      if ($page == 0) $page = 1;                  //if no page var is   given, default to 1.
      $prev = $page - 1;                          //previous   page is page - 1
      $next = $page + 1;                          //next page is page + 1
      $lastpage = ceil($total_pages/$limit);      //lastpage is = total pages / items  per page, rounded up.
      $lpm1 = $lastpage - 1;                      //last page minus 1
  
      /* 
          Now we apply our rules and draw the pagination object. 
          We're actually saving the code to a variable in case we want to draw it more than once.
      */
      $pagination = "";
      if($lastpage &gt; 1)
      {   
          $pagination .= "&lt;div class=\"pagination\"&gt;";
          //previous button
          if ($page &gt; 1) 
              $pagination.= "&lt;a href=\"$targetpage?page=$prev\"&gt;&lt;div class=\"pPrev pButton pGroup\"&gt;
                  &lt;span&gt;&lt;/span&gt;
                  &lt;/div&gt;&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
  
          else
              $pagination.= "&lt;div class=\"pPrev pButton pGroup\"&gt;
                  &lt;span&gt;&lt;/span&gt;
                  &lt;/div&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";  
  
          //pages 
          if ($lastpage &lt; 7 + ($adjacents * 2))   //not enough pages to bother breaking it up
          {   
              for ($counter = 1; $counter &lt;= $lastpage; $counter++)
              {
                  if ($counter == $page)
                      $pagination.= "&lt;div    class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                  else
                      $pagination.= "&lt;a href=\"$targetpage?  page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                   
              }
          }
          elseif($lastpage &gt; 5 + ($adjacents * 2))    //enough pages to hide some
          {
              //close to beginning; only hide later pages
              if($page &lt; 1 + ($adjacents * 2))        
              {
                  for ($counter = 1; $counter &lt; 4 + ($adjacents * 2); $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= "&lt;div  class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
                  }
                  $pagination.= "&lt;div class=\"pGroup\"&gt;...&lt;/div&gt;";
                  $pagination.= "&lt;div class=\"pGroup\"&gt;&lt;a href=\"$targetpage? page=$lpm1\"&gt;$lpm1&lt;/a&gt;&lt;/div&gt;";
                  $pagination.= "&lt;div class=\"pGroup\"&gt;&lt;a href=\"$targetpage? page=$lastpage\"&gt;$lastpage&lt;/a&gt;&lt;/div&gt;";      
              }
              //in middle; hide some front and some back
              elseif($lastpage - ($adjacents * 2) &gt; $page &amp;&amp; $page &gt; ($adjacents  * 2))
              {
                  $pagination.= "&lt;div class=\"pGroup\"&gt;&lt;a href=\"$targetpage? page=1\"&gt;1&lt;/a&gt;&lt;/div&gt;";
                  $pagination.= "&lt;div class=\"pGroup\"&gt;&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;&lt;/div&gt;";
                  $pagination.= "&lt;div class=\"pGroup\"&gt;...&lt;/div&gt;";
                  for ($counter = $page - $adjacents; $counter &lt;= $page + $adjacents; $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= " &lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
                  }
                  $pagination.= "...";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lpm1\"&gt;$lpm1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lastpage\"&gt;$lastpage&lt;/a&gt;";       
              }
              //close to end; only hide early pages
              else
              {
                  $pagination.= "&lt;a href=\"$targetpage?page=1\"&gt;1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;";
                  $pagination.= "&lt;div class=\"pGroup\"&gt;...&lt;/div&gt;";
                  for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter &lt;= $lastpage; $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= "&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage? page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                    
                  }
              }
          }
  
          //next button
          if ($page &lt; $counter - 1) 
              $pagination.= "&lt;a href=\"$targetpage?page=$next\"&gt;&lt;div   class=\"pNext pButton pGroup\"&gt;
                       &lt;/div&gt;&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
          else
              $pagination.= "&lt;div class=\"pNext pButton pGroup\"&gt;&lt;/div&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
          $pagination.= "&lt;/div&gt;\n";       
      }
          if ($page == 0) $page = 1;                  //if no  page var is given, default to 1.
      $prev = $page - 1;                          //previous  page is page - 1
      $next = $page + 1;                          //next page is page + 1
      $lastpage = ceil($total_pages/$limit);      //lastpage is = total pages / items per page, rounded up.
      $lpm1 = $lastpage - 1;                      //last page minus 1
  
      /* 
          Now we apply our rules and draw the pagination object. 
          We're actually saving the code to a variable in case we want to draw it more than once.
      */
      $pagination = "";
      if($lastpage &gt; 1)
      {   
          $pagination .= "&lt;div class=\"pagination\"&gt;";
          //previous button
          if ($page &gt; 1) 
              $pagination.= "&lt;a href=\"$targetpage?page=$prev\"&gt;&lt;div class=\"pPrev pButton pGroup\"&gt;
                  &lt;span&gt;&lt;/span&gt;
                  &lt;/div&gt;&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
  
          else
              $pagination.= "&lt;div class=\"pPrev pButton pGroup\"&gt;
                  &lt;span&gt;&lt;/span&gt;
                  &lt;/div&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";  
  
          //pages 
          if ($lastpage &lt; 7 + ($adjacents * 2))   //not enough pages to bother breaking it up
          {   
              for ($counter = 1; $counter &lt;= $lastpage; $counter++)
              {
                  if ($counter == $page)
                      $pagination.= "&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                  else
                      $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
              }
          }
          elseif($lastpage &gt; 5 + ($adjacents * 2))    //enough pages to hide some
          {
              //close to beginning; only hide later pages
              if($page &lt; 1 + ($adjacents * 2))        
              {
                  for ($counter = 1; $counter &lt; 4 + ($adjacents * 2); $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= "&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
                  }
                  $pagination.= "...";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lpm1\"&gt;$lpm1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lastpage\"&gt;$lastpage&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";     
              }
              //in middle; hide some front and some back
              elseif($lastpage - ($adjacents * 2) &gt; $page &amp;&amp; $page &gt; ($adjacents * 2))
              {
                  $pagination.= "&lt;a href=\"$targetpage?page=1\"&gt;1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;";
                  $pagination.= "...";
                  for ($counter = $page - $adjacents; $counter &lt;= $page + $adjacents; $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= " &lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
                  }
                  $pagination.= "...";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lpm1\"&gt;$lpm1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=$lastpage\"&gt;$lastpage&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";     
              }
              //close to end; only hide early pages
              else
              {
                  $pagination.= "&lt;a href=\"$targetpage?page=1\"&gt;1&lt;/a&gt;";
                  $pagination.= "&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;";
                  $pagination.= "...";
                  for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter &lt;= $lastpage; $counter++)
                  {
                      if ($counter == $page)
                          $pagination.= "&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;";
                      else
                          $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;&lt;div class=\"pGroup\"&gt;$counter&lt;/div&gt;&lt;/a&gt;";                 
                  }
              }
          }
  
          //next button
          if ($page &lt; $counter - 1) 
              $pagination.= "&lt;a href=\"$targetpage?page=$next\"&gt;&lt;div class=\"pNext pButton pGroup\"&gt;
                       &lt;/div&gt;&lt;/a&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
          else
              $pagination.= "&lt;div class=\"pNext pButton pGroup\"&gt;&lt;/div&gt;&lt;div class=\"btnseparator\"&gt;&lt;/div&gt;";
          $pagination.= "&lt;/div&gt;\n";       
      }?&gt;  
  
    &lt;div id="flexme1"&gt;&lt;table&gt;
              &lt;thead&gt;
                     &lt;tr&gt;
  
                      &lt;th width="100"&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="90"&gt;&lt;strong&gt;Mobile&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="75"&gt;&lt;strong&gt;Occasion Type&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="80"&gt;&lt;strong&gt;Occasion Date&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="70"&gt;&lt;strong&gt;Approx Gust&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="150"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="150"&gt;&lt;strong&gt;Address&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="120"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="75"&gt;&lt;strong&gt;Other Contact&lt;/strong&gt;&lt;/th&gt;
  
                      &lt;th width="70"&gt;&lt;strong&gt;Enquiry Date&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="80"&gt;&lt;strong&gt;Author&lt;/strong&gt;&lt;/th&gt;
                      &lt;th width="100"&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/th&gt;
  
                  &lt;/tr&gt;
              &lt;/thead&gt;&lt;/table&gt;
  
  
             &lt;?php while($data = mysql_fetch_array($sql)){?&gt;
  
       &lt;form name="form" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt; 
  
              &lt;table border="0" cellspacing="0" cellpadding="0" &gt;
              &lt;tbody&gt; 
  
                   &lt;tr&gt;   &lt;input name="id" type="hidden" value="&lt;?php echo $data['0']; ?&gt;" &gt;
                      &lt;td&gt;&lt;?php echo $data['2']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['3']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['8']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['9']; ?&gt;&lt;/td&gt;          
                      &lt;td&gt;&lt;?php echo $data['10']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['11']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['4']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['5']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['6']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['12']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $data['13']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input name="edit" type="submit" value="Edit"&gt;
                      &lt;input  name="BOOK" type="submit" value="Book" style="color:#d90f0f"&gt;
  
                      &lt;/td&gt;
                      &lt;/tr&gt;
  
  
  
              &lt;/tbody&gt;
               &lt;/table&gt;
               &lt;/form&gt;
               &lt;?php } ?&gt;&lt;/div&gt;
  
  
              &lt;div class="flexigrid"&gt;
              &lt;div class="pDiv"&gt;
              &lt;div class="pDiv2"&gt;
  
  
                &lt;div class="pGroup"&gt;
                &lt;select name="rp" id="rp"  &gt;
                &lt;option value="10"&gt;10&amp;nbsp;&amp;nbsp;&lt;/option&gt;
                &lt;option value="15"&gt;15&amp;nbsp;&amp;nbsp;&lt;/option&gt;
                &lt;option value="20"&gt;20&amp;nbsp;&amp;nbsp;&lt;/option&gt;
                &lt;option value="30"&gt;30&amp;nbsp;&amp;nbsp;&lt;/option&gt;
                &lt;option value="50"&gt;50&amp;nbsp;&amp;nbsp;&lt;/option&gt;
                &lt;/select&gt;
                &lt;/div&gt; 
                &lt;div class="btnseparator"&gt;&lt;/div&gt;
                 &lt;?=$pagination?&gt;
  
  
                        &lt;div class="axport"&gt;
                        &lt;h2&gt;Export&lt;/h2&gt;
                          &lt;div class="pGroup"&gt;
                              &lt;div class="pdf_button  pButton"&gt;PDF&lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="btnseparator"&gt;&lt;/div&gt;
                          &lt;div class="pGroup"&gt;
          &lt;?php 
           $types = $_POST['types'];
         $filter = $_POST['filter'];
         $from = $_POST['From'];
          $to = $_POST['To'];
          ?&gt;
                              &lt;div class="excel_button pButton"&gt;
                              &lt;form action="excel.php"   method="POST"&gt;
                              &lt;input name="types" type="hidden"     value="&lt;?php echo $types;?&gt;"&gt;
                              &lt;input name="filter" type="hidden" value="&lt;?php echo $filter;?&gt;"&gt;
                              &lt;input name="from" type="hidden" value="&lt;?php echo $from;?&gt;"&gt;
                              &lt;input name="to" type="hidden" value="&lt;?php echo $to;?&gt;"&gt;                           
                              &lt;input type="submit" value="Excel"&gt; 
                              &lt;/form&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;/div&gt;
  
  
  
  
          &lt;script type="text/javascript"&gt;
          //&lt;![CDATA[
          jQuery(document).ready(function($) {
              $('#flexme1').flexigrid();
          });
          //]]&gt;
          &lt;/script&gt;
          &lt;/div&gt;
           &lt;/div&gt;
          &lt;div id="footer"&gt;
           &lt;p&gt;Copyright © &lt;span&gt;&lt;a href="#"&gt;Aum Digital Marketing&lt;/a&gt;&lt;/span&gt; , All rights    reserved&lt;/p&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;`
  </code></pre>