duanfan1965 2016-04-19 10:25
浏览 197
已采纳

即使用户再次刷新页面,如何只更新一次?

I want to update only once even when the user refreshes the page many times.How can I do that?

updateunblockedbooks.php

if($quantbuy<=$quantity){
    $upd="update books set quantity=quantity-'$quantbuy' where code='$code' ";
    mysqli_query($con,$upd);
}

HTML form page

<form name="updatebook" action="updateunblockedbooks.php" method="get">
quantity:<br/><input type="number" name="quantbuy" id="quantity" required><br/>
Code:<br/><input type="number" name="code" id="code"><br/>
<input type="submit" value="submit" onclick="return validate2();"><br/>

Is using header after updating a good idea for my question?

  • 写回答

4条回答 默认 最新

  • dongyingdao8867 2016-04-19 10:38
    关注

    You can redirect to that page where this form is filled from or you can redirect to a thank you page and you can also send some message to the redirection page and according to that message value you can display success or error message so the person filling the form knows what happened.

    So redirect like this:

    header("location:redirection-page-name.php?msg=success");
    

    And on the page where this redirects to get that msg and display message.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)