drcb19700 2017-03-20 07:18
浏览 26

分页在php和mysql中不起作用

Here I am going to paginate chapter_subscriptions table which has many rows. So I am trying to paginate in such a way that at a time 10 rows will be displayed. My problem is when I click the insert button, the page variable in the jQuery code isn't assigned a value and stays undefined. Then the sql query in chapter_subscription_searchpagination.php fails. I can't figure out where I've made a mistake.

chapter_subscription_search.php

<?php
  include('db.php');
  $start_date=date("Y-m-d");
?>
<html>
  <head>
    <title>Chapter Subscriptions</title>
    <script src="js/jquery-1.12.4.js"></script>
    <script src="js/jquery-ui.js"></script>
  </head>
  <body>
    <header>
      <img src="images/ipoint.png" class="logo" /> USER REGISTRATION</header>
      <div class="container">
        <h1 style="text-align:center">ADDING THE CHAPTER SUBSCRIPTION DETAILS</h1>
        <form name="chapter_subscriptions" id="chapter_subscriptions" action="#" method="post">

          <?php
          $end_date1 = date('Y-m-d', strtotime("+3 months"));
          $end_date2 = date('Y-m-d', strtotime("+6 months"));
          $end_date3 = date('Y-m-d', strtotime("+9 months"));
          ?>

          <table align='center' border='1'>
            <tr>            
              <td>
                <label for="userid">UserId</label>
              </td>
              <td>
                <input id="userid" name="userid"  type="text" />
              </td>
            </tr>
            <tr>
              <td>
                <label for="chapter_no">ChapterNumber</label>
              </td>
              <td>
                <input id="chapter_no" name="chapter_no" type="text"/>
              </td>
            </tr>
            <tr>
              <td>
                <label for="start_date">StartDate</label>
              </td>
              <td>
                <input id="start_date" name="start_date" type="text"/>
              </td>
          </tr>
          <tr>
            <td>
              <label for="end_date">EndDate</label>
            </td>
            <td>
              <select name="end_date" id="end_date">
                <option value=<?php echo $end_date1; ?>><?php echo $end_date1; ?></option>
                <option value=<?php echo $end_date2; ?>><?php echo $end_date2; ?> </option>
                <option value=<?php echo $end_date3;?>><?php echo $end_date3;?> </option>

              </select>
            </td>
          </tr>
        </table>

        <div id="wrap">
          <input type="submit" name="insert" id="insert" value="insert">
          <input type="submit" name="edit" id="edit" value="edit">
        </div>

      </form>
    </div>

    <script type="text/javascript">
      $(document).ready(function(){
        $("#insert").click(function(e){     
          var userid = $("#userid").val();
          var chapter_no = $("#chapter_no").val();
          var start_date = $("#start_date ").val();
          var end_date = $("#end_date").val();
          var page = $("#page").val();
          alert(page);
        });
      });
    </script>

    <div id="display"></div>

  </body>

</html>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于大棚监测的pcb板设计
    • ¥20 sim800c模块 at指令及平台
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计