<small id='ORXyp'></small><noframes id='ORXyp'>

    <bdo id='ORXyp'></bdo><ul id='ORXyp'></ul>

    <i id='ORXyp'><tr id='ORXyp'><dt id='ORXyp'><q id='ORXyp'><span id='ORXyp'><b id='ORXyp'><form id='ORXyp'><ins id='ORXyp'></ins><ul id='ORXyp'></ul><sub id='ORXyp'></sub></form><legend id='ORXyp'></legend><bdo id='ORXyp'><pre id='ORXyp'><center id='ORXyp'></center></pre></bdo></b><th id='ORXyp'></th></span></q></dt></tr></i><div id='ORXyp'><tfoot id='ORXyp'></tfoot><dl id='ORXyp'><fieldset id='ORXyp'></fieldset></dl></div>
    <tfoot id='ORXyp'></tfoot>
      <legend id='ORXyp'><style id='ORXyp'><dir id='ORXyp'><q id='ORXyp'></q></dir></style></legend>
      1. 防止在点击返回按钮时重新提交表单

        Prevent Form resubmission upon hitting back button(防止在点击返回按钮时重新提交表单)
        <legend id='afp8M'><style id='afp8M'><dir id='afp8M'><q id='afp8M'></q></dir></style></legend>
      2. <i id='afp8M'><tr id='afp8M'><dt id='afp8M'><q id='afp8M'><span id='afp8M'><b id='afp8M'><form id='afp8M'><ins id='afp8M'></ins><ul id='afp8M'></ul><sub id='afp8M'></sub></form><legend id='afp8M'></legend><bdo id='afp8M'><pre id='afp8M'><center id='afp8M'></center></pre></bdo></b><th id='afp8M'></th></span></q></dt></tr></i><div id='afp8M'><tfoot id='afp8M'></tfoot><dl id='afp8M'><fieldset id='afp8M'></fieldset></dl></div>

          <bdo id='afp8M'></bdo><ul id='afp8M'></ul>

                <small id='afp8M'></small><noframes id='afp8M'>

                <tfoot id='afp8M'></tfoot>
                  <tbody id='afp8M'></tbody>
                • 本文介绍了防止在点击返回按钮时重新提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在这里和其他地方搜索了许多帖子,但似乎找不到解决我的问题的方法.我有一个显示数据库条目的页面:database.php.可以使用表单过滤这些条目.当我过滤它们并只显示我感兴趣的那些时,我可以单击一个条目(作为链接),它将我带到该条目页面(通过 php GET).当我在该条目页面(即view.php?id=1")并点击后退按钮(返回到 database.php)时,过滤器表单需要确认表单重新提交.有什么办法可以防止这种情况发生吗?

                  I have searched many posts here and elsewhere but can't seem to find a solution to my problem. I have a page which displays database entries: database.php. These entries can be filtered with a form. When I filter them and only display the ones I am interested in I can click an entry (as a link) which takes me to that entries page (via php GET). When I am on that entries page (i.e., "view.php?id=1") and hit the back button (back to database.php), the filter form requires to confirm the form resubmission. Is there any way to prevent this?

                  这里有一些(简化的)代码示例:

                  here are some (simplified) code examples:

                  Database.php:

                  <form>
                      <select>
                          <option>1</option>
                          <option>2
                          <option>
                      </select>
                      <input type="submit" name="apply_filter" />
                  </form>
                  <?php
                  if ( isset( $_POST[ "apply_filter" ] ) ) { // display filtered entries
                      $filter = $_POST[ "filter" ];
                      $q = "Select * from table where col = '" . $filter . "'";
                      $r = mysql_query( $q );
                  } else { // display all entries
                      $q = "Select * from table";
                      $r = mysql_query( $q );
                  }
                  while ( $rec = mysql_fetch_assoc( $r ) ) {
                      echo "<a href='view.php?id=" . $rec[ "id" ] . "'>" . $rec[ "name" ] . "</a><br />"; // this is where the link to the view.php page is...
                  }
                  ?>
                  

                  现在如前所述,如果我点击链接,它会带我到view.php?id=whatever".在该页面上,我只是从 url 中获取 ID 以显示该单个条目:

                  Now as mentioned, if I click on the link, it takes me to "view.php?id=whatever". On that page, I just get the ID from the url to display that single entry:

                  view.php:

                  <?php
                  $id = $_GET[ "id" ];
                  $q = "Select * from table where id = '" . $id . "'";
                  $r = mysql_query( $q );
                  while (  ) {
                      // display entry
                  }
                  
                  ?>
                  

                  如果我现在点击后退按钮,database.php 上的表单(用于过滤数据库结果的表单)需要确认重新提交.这不仅很烦人,对我也没用.

                  If I now hit the back button, the form on database.php (the one used to filter the DB results) requires confirmation for resubmission. Not only is this very annoying, its also useless to me.

                  我该如何解决这个问题?我希望代码示例和我的问题的解释是足够的.如果没有让我知道,我会尽量指定.

                  How can I fix this? I hope the code examples and explanation of my problem are sufficient. If not let me know and I'll try to specify.

                  推荐答案

                  我知道这个问题很老,但我自己也有这个问题,我发现有两行是:

                  I know this question is old, but having this issue myself, two lines I've discovered that works are:

                  header("Cache-Control: no cache");
                  session_cache_limiter("private_no_expire");
                  

                  这篇关于防止在点击返回按钮时重新提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <tbody id='5BLR4'></tbody>
                  <i id='5BLR4'><tr id='5BLR4'><dt id='5BLR4'><q id='5BLR4'><span id='5BLR4'><b id='5BLR4'><form id='5BLR4'><ins id='5BLR4'></ins><ul id='5BLR4'></ul><sub id='5BLR4'></sub></form><legend id='5BLR4'></legend><bdo id='5BLR4'><pre id='5BLR4'><center id='5BLR4'></center></pre></bdo></b><th id='5BLR4'></th></span></q></dt></tr></i><div id='5BLR4'><tfoot id='5BLR4'></tfoot><dl id='5BLR4'><fieldset id='5BLR4'></fieldset></dl></div>

                      <bdo id='5BLR4'></bdo><ul id='5BLR4'></ul>

                      <small id='5BLR4'></small><noframes id='5BLR4'>

                    • <legend id='5BLR4'><style id='5BLR4'><dir id='5BLR4'><q id='5BLR4'></q></dir></style></legend>
                      1. <tfoot id='5BLR4'></tfoot>