Pagination not working on isset method

I'm showing photo from database with onclick

 <div class="align_center  gallery">

     <?php
         if(isset($_GET['s'])){
             include "anj.php";

             $sql =  'SELECT * FROM new_photos WHERE weight BETWEEN 10 AND 
             15';

             anjaan($sql);
         }else{
                include "anj.php";
                $sql='select * from new_photos';
                anjaan($sql);
             }
    ?>
    </div>
        <div class="  align_center ">
        <div class=" col-md-12 pagination gallery">
            <?php    
                echo $paginationctrl;
            ?>
        </div>

My problem is when I click on next page from pagination, it show next page from else statement's query.

I mean I want my second page load from

  'SELECT * FROM new_photos WHERE weight BETWEEN 10 AND 
             15';

But it show next page from

'SELECT * FROM new_photos ';

1 answer

  • answered 2017-06-17 18:22 Mason.Chase

    This could be in HTML That is not a very secure approach, I would recommend to change INPUT to:

     <input type="submit" onclick="javascript:window.assign ='index.php?s=nextpage'" class="btn_custom" />
    

    if that didn't work, please enable developer mode in Chrome or Firefox and check your HTTP header to make sure you see GET header.

    also it may affect you if you have a POST form in your page that we can't see