doujiaozhao2489 2019-04-03 03:33
浏览 29

即使我转到第二页或后退按钮,如何留在第一页的当前数据

How to stay in current data in first page even though im going to second page or back button and if im going back again to the first page when the current data is the same?

in my first page there is a next button and the existing data and that is number 1, the number 1 is containing of my data in database then if i click the next button other data will show or the number 2 data. on this scenario i want to go to 2nd page or ill click the back button if want to see other things afterwards. i want to go back again to the first page where my current data is number 2.

on my code if i click next button then existing is 2 and click the back button and click the first page again. it will back again to 1.

this is my code

<div class="card card-register mx-auto mt-5">
  <div class="card-header">Queuing System

  <div class="card-body">
      <div class="form-group">
        <div class="form-row">
          <div class="col">   
            <div class="form-label-group">



            <link href="pagination.css" type="text/css" rel="stylesheet">
    <?php
        include 'myconn.php';

        $rowperpage = 1;
        $row = 0;

        // Next Button
        if(isset($_POST['Next'])){
            $row = $_POST['row'];
            $allcount = $_POST['allcount'];

            $val = $row + $rowperpage;
            if( $val < $allcount ){
                $row = $val;
            }
        }
    ?>
</head>
<body>
<div id="content">
    <table width="100%" id="emp_table" >
        <tr class="tr_header">
            <th>Queuing Number</th>
            <th>First Name</th>
            <th>LastName</th>
        </tr>

        <?php
        // count total number of rows
        $sql = "SELECT COUNT(*) AS cntrows FROM accounting_1";
        $result = mysqli_query($con,$sql);
        $fetchresult = mysqli_fetch_array($result);
        $allcount = $fetchresult['cntrows'];

        // selecting rows
        $sql = "SELECT * FROM accounting_1  ORDER BY que_number ASC limit $row,".$rowperpage;
        $result = mysqli_query($con,$sql);
        $que_number = $row + 1;
        while($fetch = mysqli_fetch_array($result)){
            $fname = $fetch['fname'];
            $lname = $fetch['lname'];
            ?>
            <tr>
                <td align='center'><?php echo $que_number; ?></td>
                <td align='center'><?php echo $fname; ?></td>
                <td align='center'><?php echo $lname; ?></td>
            </tr>
        <?php
            $que_number ++;
        }
        ?>
    </table>


    <form method="post" action="">
        <div id="div_pagination">
            <input type="hidden" name="row" value="<?php echo $row; ?>">
            <input type="hidden" name="allcount" value="<?php echo $allcount; ?>">
            <!--next button  -->
            <br>
            <div class="row">  
               <div class="col-sm-6">
                  <br>
                  <button type="submit" id="nextBtn" class="btn btn-danger btn-block" name="Next">Next</button>
              </div>
              <div class="col-sm-6">
                  <br>
                  <a class="btn btn-danger btn-block" href="AccountingOfficer.php" data-toggle="modal" data-target="#logoutModal" >Back</a>
            </div>
       </div>

i expect the output is

if i click next button then existing is 2 and click the back button and click the first page again. it will be exist to 2 not back at 1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 AT89C51控制8位八段数码管显示时钟。
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题