如何从$ POST向两个网站提交电子邮件

时间:2013-06-19 17:59:47

标签: php email

我一直在网上搜索类似的问题但没有找到,我的帮助将不胜感激。我有一个网页,它接受用户输入的电子邮件地址,但我想将其提交给两种不同的形式,其中一种我没有服务器访问权限。我该怎么办?我听说在这种情况下可以使用iframe,但我不完全确定。

再次感谢。

-MDB

1 个答案:

答案 0 :(得分:0)

第一种形式:

<form name="Sendform" method="post" action="https://aaa.bbb.com/somthing" target="_blank" accept-charset="UTF-8">
<input class="send_input" type="text" name="1" id="1" placeholder="name" />
<img src="/images/sendBTN.png" onclick="Sendform.submit();submitForm();"/>
</form>
//Sendform.submit(); <-- sending it to the action url
//submitForm(); <-- call a js function that will send another email

第二个

function submitForm()
{
    var first = $("input#1.send_input").val();
    var redirect = 'http://localhost:8088';
    var action = 'http://localhost:8088/wp-login.php?action=register';
    var method = 'post';
    var params = {'first_name':first,'redirect_to':redirect};

    var form = document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", action);    
    form.setAttribute("accept-charset","UTF-8");
    form.setAttribute("name", "registerform");
    form.setAttribute("id", "registerform");
    for(var key in params) {
        if(params.hasOwnProperty(key)) {
            var hiddenField = document.createElement("input");
            hiddenField.setAttribute("type", "hidden");
            hiddenField.setAttribute("name", key);          
            hiddenField.setAttribute("id", key);
            hiddenField.setAttribute("value", params[key]);
            form.appendChild(hiddenField);
         }
    }
    document.body.appendChild(form);
    form.submit();//<-- send the second email
}