如何避免确认表格重新提交?

时间:2013-03-30 14:26:41

标签: php html forms submission

有没有办法避免确认表格重新提交? The page that you're looking for used information that you entered. Returning to that page might cause any action that you took to be repeated.Do you want to continue?使用javascript或jquery函数任何一种示例来避免确认表单重新提交?

function getComboB(sel) { 
var invoices=document.getElementById("invoices");
var input_val = document.getElementById("invoices").value; 
invoices.action = "searchinvoices.php?invoices="+input_val+"";
invoices.submit();
} 


<table width="371" border="2">
<form name="invoices" id="invoices">
<tr>
<td width="160"><font class="font2">&nbsp;Search By Invoice's Number:</font></td>
<td width="198"><input type="text" class="input_field" style="background:#FFF !important;" name="invoices" id="invoices" onchange="getComboB();" ></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</form>
</table>

1 个答案:

答案 0 :(得分:0)

这似乎是浏览器自动实现的一项功能,作为安全功能。这不容易被绕过,因为它是浏览器软件的一部分。我最好的两个建议是使用标题重定向用户(如果你可以在页面上使用一些PHP):

header("Location: http://example.com");

或者查看Chrome是否有flag。在其他浏览器中,您可能会失败。干杯!