dongwen2794 2015-10-09 01:28
浏览 85

在重定向付款之前,希望paypal订阅按钮在页面中向我提交表单

Hi I have a form and a paypal subscribe button in the same page. I want to subscribe button when clicked to submit the form (email it to me) before it redirects to paypal for payment.

<!--THE CONTACT FORM-->

  <center> 
<form action="createUser.php" method="POST"> 

<input id="email" type="email" name="email" placeholder= "Email Address"  required  value= <?php echo htmlspecialchars($_POST['email1']); ?> > 


    <br>

    <input id="fullName" type="text" name="fullName" placeholder="Your Full Name" required value= <?php echo htmlspecialchars($_POST['fullName1']); ?>>

    <br>
        <input id="tel" type="tel" name="tel" placeholder="Your Number" required>

    <br>

    <center>

        </center>

        </form>

<!--THE CONTACT FORM-->

<!--Paypal Button-->

        <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="DLNYHMF3A6TUE">
    <input type="submit" value="Add to Cart" name="submit" class="paypal_btn">
</form>
    <!--Paypal Button-->
  • 写回答

1条回答 默认 最新

  • dow57588 2015-10-09 02:13
    关注

    In this case its a really bad solution but its possible to submit a POST to your server via AJAX before redirecting the browser to Paypal checkout.

    <script type="text/javascript">
    document.getElementsByClassName('paypal_btn')[0].onclick = function(){
     var xhttp = new XMLHttpRequest();
     xhttp.open("POST", "createUser.php", true);
     xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
     xhttp.send("email="+document.getElementById('email').value+"&fullName="+document.getElementById('fullName').value+"&tel="+document.getElementById('tel').value);
    }
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向