我有两个<input type ="submit">
,formaction
内有<form method="post" action="">
,这些傻瓜在刷新时提示Confirm Form Resubmission
:
<form method = "post" action="">
<input class = "button" type="submit" name="dhcp" value="DHCP IP" title="Redirect to DHCP IP Config page" formaction="/dhcp_ip.php">
<input class = "button" type="submit" name="static" value="Static IP" title="Redirect to Static IP Config page" formaction="/static_ip.php">
</form>
我被认为是<form method="post">
或任何POST
方法提示Confirm Form Resubmission
,所以我删除了该表单,并用两个button
元素替换了该表单:
<button class="button" onclick="goDHCP()">DHCP IP</button>
<button class="button" onclick="goStatic()">Static IP</button>
<script>
function goDHCP() {
window.location.replace("/dhcp_ip.php");
}
function goStatic() {
window.location.replace("/static_ip.php");
}
</script>
但这还会提示Confirm Form Resubmission
进行刷新。
提示什么元素?而且我怎么不提示呢?因为我在其他页面上也有一些<input type="text">
,所以除非用户开始在其中输入内容,否则它们不会提示Confirm Form Resubmission
刷新。
答案 0 :(得分:1)
Confirm Form Resubmission
表示您正在尝试刷新发送数据的页面。
如果您不想弹出此窗口,请单击URL栏,然后按Enter键以重新访问同一页面而不发送数据。
关于您的表格...
<?php
if (!empty($_POST['submit'])) {
echo '
<script type="text/javascript">
window.location.replace("/'.$_POST['direction'].'.php");
</script>
';
}
?>
<form method="post" action="">
<select name="direction">
<option value="dhcp_ip">Redirect to DHCP IP Config page</option>
<option value="static_ip">Redirect to the Static IP Config page</option>
</select>
<button type="submit" name="submit" value="submit">
Visit page
</button>
</form>
如果您需要任何解释,请告诉我。