在 PHP 中验证输入后将表单数据重定向/POST 到站点
所以我有一个连接到 PayPal 的一份静修登记表。现在,在将其连接到 PayPal 之前,我在 PHP 中设置了代码来检查每个字段是否有效并正确清理它们。之后,它会将这个人添加到数据库中。
现在,我想要发生的是将用户重定向到 PayPal 支付页面,同时发送所有 POST 信息。问题是我不知道该怎么做。
到目前为止,我的边界是形式的动作。如果我希望验证/清理所有字段并将用户放入我的数据库中,我会将表单的操作设置为本地 register.php
。如果我希望我的用户实际上被发送到 PayPal,他的信息也通过 POST 传送,那么我将表单的操作设置为 https://www.sandbox.paypal.com/cgi-bin/webscr
(仍在 PayPal 沙箱中。)
有没有办法可以将表单的操作设置为 register.php
,然后将 POST 信息发送到 https://www.sandbox。 paypal.com/cgi-bin/webscr
?
So I have a retreat registration form that is hooked up to PayPal. Now, before I hooked it up to PayPal, I setup code in PHP to go through and check if each field was valid and sanitize them properly. After that, it would add this person to a database.
Now, what I wanted to happen after that is for it to redirect the user to the PayPal paying page, sending along all the POST information as well. Problem is I have no clue how to do that.
So far, my boundary is the form's action. If I want all the fields to be validated/sanitized and have the user put into my database, I set the form's action to the local register.php
. If I want my user to actually be sent to PayPal where his information gets carried along aswell via POST then I set the form's action to https://www.sandbox.paypal.com/cgi-bin/webscr
(Still in the PayPal sandbox.)
Is there a way that I can have the form's action set to register.php
and then send the POST information to https://www.sandbox.paypal.com/cgi-bin/webscr
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在保存信息的页面上,显示“请稍候...”消息,然后创建一个隐藏表单,其操作指向 paypal url,通过 php 将所有字段放入其中,使它们隐藏并使用 javascript 发布表单自动到贝宝。
On the page you save your information, show a "please wait ... " message, then create a hidden form with action pointed to paypal url , via php put in all the fields in it , make them hidden and using javascript post the form automatically to paypal.