两种不同的POST动作?可能?

编程入门 行业动态 更新时间:2024-10-17 02:48:04
本文介绍了两种不同的POST动作?可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何创建一个两个提交按钮的表单,其中每个按钮提交表单输入数据到另一个服务器? 考虑这种情况:我有一个表单,用户可以查看各种 选项来订阅服务,每个选项都需要花费一定的金额。提交表单时,我的php脚本总计了 选项。好的。 表单有2个提交按钮:打印发票和通过信用卡支付 卡。 打印发票按钮适用于那些无法用信用卡支付的商家,但必须向我们发送支票;他们为应付账款部门打印发票 。 php脚本根据表单输入生成 发票。简单,没问题。 问题是通过信用卡付款。提交的 输入字段的总费用必须张贴到其他服务器:我们的信用卡 处理器。 这不是如果信用卡处理器接受 表单输入数据作为URL中的GET字符串,则会出现问题;我要做的就是 header(" Location:$ url");将用户重定向到信用卡 处理付款的处理器页面。问题是我需要通过张贴表单输入数据来执行此操作,同时 保留使用 相同的表格。 我不能想到一个优雅的方式来做到这一点,除了有两个 不同的付款页面每个他们自己的形式。或者也许强迫 每个人都生成发票作为第一步,然后在 点后他们可以选择用信用卡支付。 -A

How do I create a form that two submit buttons, where each one submits the form input data to a different server? Consider this situation: I have a form where users can check various options to subscribe to a service, and each option costs a certain amount. When the form is submitted, my php script totals up the options. Fine. The form has 2 submit buttons: "print invoice" and "pay by credit card." The "print invoice" button is for those businesses who can''t pay by credit card but must mail us a check instead; they print an invoice for their accounts payable department. The php script generates the invoice based on the form inputs. Easy, no problem. The problem is "pay by credit card." The total cost from submitted input fields must be POSTed to a different server: our credit card processor. This isn''t a problem if the credit card processor accepts the form input data as a GET string in the URL; all I''d do is header("Location: $url"); to redirect the user to the credit card processor page which handles the payment. The problem is I need to do this by POSTing the form input data, while at the same time retain the ability to generate invoices from MY server using the same form. I can''t think of an elegant way to do this except to have two different payment pages each with their own form. Or maybe force everybody to generate an invoice as the first step, and after that point they can choose to pay it by credit card. -A

推荐答案

url");将用户重定向到信用卡 处理付款的处理器页面。问题是我需要通过张贴表单输入数据来执行此操作,同时 保留使用 相同的表格。 我不能想到一个优雅的方式来做到这一点,除了有两个 不同的付款页面每个他们自己的形式。或者也许强迫 每个人都生成发票作为第一步,然后在 点后他们可以选择用信用卡支付。 -A url"); to redirect the user to the credit card processor page which handles the payment. The problem is I need to do this by POSTing the form input data, while at the same time retain the ability to generate invoices from MY server using the same form. I can''t think of an elegant way to do this except to have two different payment pages each with their own form. Or maybe force everybody to generate an invoice as the first step, and after that point they can choose to pay it by credit card. -A

我做的是在帖子表单中创建一个虚拟动作,并使用 javascript函数交换一个新动作,然后根据不同按钮的onclick调用提交 方法。 - whit axlq写道: What I did was to create a dummy action in the post form, and use a javascript function to swap in a new action and then call the submit method based on the onclick of different buttons. -- whit axlq wrote: 如何创建一个两个提交按钮的表单,其中每一个 提交表单输入数据到另一台服务器? 考虑这种情况:我有一个表单,用户可以查看各种 选项来订阅服务,每个选项都需要一个某些 金额。提交表单时,我的php脚本总计了 选项。好的。 表单有2个提交按钮:打印发票和通过信用卡支付 卡。 打印发票按钮适用于那些无法用信用卡支付的商家,但必须向我们发送支票;他们为应付账款部门打印发票 。 php脚本根据表单输入生成 发票。简单,没问题。 问题是通过信用卡付款。提交的 输入字段的总费用必须张贴到其他服务器:我们的信用卡 处理器。 这不是如果信用卡处理器接受 表单输入数据作为URL中的GET字符串,则会出现问题;我要做的就是 header(" Location: How do I create a form that two submit buttons, where each one submits the form input data to a different server? Consider this situation: I have a form where users can check various options to subscribe to a service, and each option costs a certain amount. When the form is submitted, my php script totals up the options. Fine. The form has 2 submit buttons: "print invoice" and "pay by credit card." The "print invoice" button is for those businesses who can''t pay by credit card but must mail us a check instead; they print an invoice for their accounts payable department. The php script generates the invoice based on the form inputs. Easy, no problem. The problem is "pay by credit card." The total cost from submitted input fields must be POSTed to a different server: our credit card processor. This isn''t a problem if the credit card processor accepts the form input data as a GET string in the URL; all I''d do is header("Location:

url");将用户重定向到信用卡 处理付款的处理器页面。问题是我需要通过张贴表单输入数据来执行此操作,同时 保留使用 相同的表格。 我不能想到一个优雅的方式来做到这一点,除了有两个 不同的付款页面每个他们自己的形式。或者也许强迫 每个人都生成发票作为第一步,然后在 点后他们可以选择用信用卡支付。 -A url"); to redirect the user to the credit card processor page which handles the payment. The problem is I need to do this by POSTing the form input data, while at the same time retain the ability to generate invoices from MY server using the same form. I can''t think of an elegant way to do this except to have two different payment pages each with their own form. Or maybe force everybody to generate an invoice as the first step, and after that point they can choose to pay it by credit card. -A

更多推荐

两种不同的POST动作?可能?

本文发布于:2023-11-30 16:06:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650627.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两种   动作   POST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!