1

我有一个向自身发送数据的页面,即使用PHP_SELF.

在页面刷新时,即页面重新加载时,我放置了两个按钮 - Refresh Again,我再次使用发送数据PHP_SELF。- 弹出一个警告框要求确认,这通常发生在日期再次发送到页面时。

第二个按钮的用途 - Reload without sending data,必须重新加载页面。

没有出现上述弹出框,即没有发送数据。

有没有办法在数据再次发送到服务器或页面之前清除数据?

我通过发送数据$_GET

我检查我是否收到如下任何数据:

if(isset($_GET['getVariable']))

/* I place the buttons here, in a form, the action parameter of which points to the same page, i.e. `PHP_SELF`
4

1 回答 1

2

您可以在不提交新表单的情况下进行刷新:

<form name="refresh" action="" method="post">
  <input type="submit" value="Refresh without submitting" />
</form>

或者使用 JavaScript 刷新当前按钮。

<input type="button" value="Refresh without submitting" onclick="location.reload();" />

另外,使用action=""代替PHP_SELF.

于 2013-03-06T14:39:15.797 回答