【发布时间】:2016-02-28 02:24:52
【问题描述】:
我有 3 个 php 页面,在第一个页面上,我有一个表格,用户可以在其中输入他的帐户(电子邮件地址)以及他想从他的帐户中扣除的金额。 第二次我调用了函数并显示了成功消息。 在第三页,函数 send() 完成,打开数据库连接,更改帐户金额并保存。
首页:
<form action="send_exec.php" method="post">
Amount: <input type="number" size="24" maxlength="4"
name="points_send" min="0"><br><br>
Account<input type="text" size="24" maxlength="50"
name="email"><br><br>
<input type="submit" value="Send">
</form>
第二页(send_exec.php):
<?php
include("update_send.php");
$email = $_POST["email"];
$points_send = $_POST["points_send"];
settype ($points_send, "integer");
send($email, $points_send);
echo ("Success");
?>
第三页(update_send.php):
//some calculations are done before this to get $new_points
function send($email, $points_send)
{
$mysql_update_points = "UPDATE user SET points = ('$new_ponints') WHERE email = ('$email')";
$mysql_update = mysql_query($mysql_update_points);
}
现在的问题是,当我在第一页上执行操作并最终在第二页上执行时:如何在我的浏览器中单击 F5/重新加载再次调用该操作时禁用该操作?
【问题讨论】:
-
与其他人一样:将浏览器移至不同的页面。
-
最简单的方法是成功后将浏览器重定向到不同的页面;将
echo("Success");移动到新页面/脚本(我们将其命名为success.php)并在send_exec.php中将其替换为header('Location: /success.php');。 -
谢谢,我不知道这个!
标签: php mysql database forms reload