简体   繁体   English

我的提交表单是在不单击表单的情况下提交数据的

[英]my submit form isn't submitting data without clicking on form

is the form below correct ? 下面的表格正确吗? I'm trying to submit the form without clicking on the submit button but it doesnt seem to submit the data 我正在尝试提交表单而不单击提交按钮,但是似乎没有提交数据

echo '<form name="myForm" id ="myForm" method="post" action="http://caliberconnect.capna.biz/box.php">';
    echo '<input name="email" type="hidden" id="email" value="$email">';
    echo '<input name="name" type="hidden" id="name" value=" $firstname $lastname">';
    echo '<input name="field1" type="hidden" id="field1" value=" ($phone_areacode) $phone_prefix-$phone_suffix ">';
    echo '<input name="field2" type="hidden" id="field2" value="$practicename">';
    echo '<input name="field3" type="hidden" id="field3" value="">';
    echo '<input name="funcml" type="hidden" id="funcml" value="add">';
    echo '<input name="p" type="hidden" id="p" value="7">';
    echo '<input type="hidden" name="nlbox[1]" value="31">';
    echo '</form>';

    echo '<script type="text/javascript">';
    echo 'document.getElementById("myForm").submit();';
    echo '</script>';

在表单中添加一个提交按钮,并使用css <input type="submit" name="" style="position:absolute;left:-9999px;"/>

You should try adding an onLoad event associated to your form and call a function of javascript where you are submitting your form 您应该尝试添加与表单关联的onLoad事件,并在提交表单的地方调用javascript函数

<form onLoad="submitFormOnLoad()">
</form>

function submitFormOnLoad()
{
    document.getElementById("myForm").submit();
}

Below is the reference for onLoad events. 以下是onLoad事件的参考。

http://www.w3schools.com/jsref/event_onload.asp http://www.w3schools.com/jsref/event_onload.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM