English 中文(简体)
PHP, Submit form onload
原标题:PHP, Submit form on load

我想在浏览器中访问PHP文档时立即提交表格。 我如何做到这一点:最好在 j。

详细情况:

我有一份表格,一旦提交,就将一些数据输入一个数据库,并将用户送到一个单独的网页。 在单独的网页上,我有另一个表格的代码,然后指示用户支付所选择的任何费用。

我不想让用户不得不点击第二种表格,以便支付费用。 因此,是否有办法使这一表格自动提交,从而引导用户进入付款阶段?

最佳回答

Invoke the submit 方法:

$("#formID").submit();

页: 1

<script>
$(function(){
    $("#your-formID").submit();
});
</script>
问题回答

你可以这样做。

<body onload="submitForm()" ></body>


<script>
function submitForm()
{
 document.frm.submit();
}
</script>

frm是形式名称

如果自动提交,那么这种形式为何存在? 第一种形式直接转向第三页,处理服务器上的其余部分。 无需向客户发送数据。 使用 Java字自动张贴可能不利于每个客户。 消除这种风险,为此提供服务器。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签