将表单信息发送到name ="firstname"和name ="name_first" [英] Sending form info to name="firstname" and name="name_first"

查看:135
本文介绍了将表单信息发送到name ="firstname"和name ="name_first"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我还没有掌握认真的代码(到目前为止),我有一个表格,提交该表格时,必须更新crm中的数据并将用户带到支付网关.感谢本网站的帮助,我已经弄清楚了如何将其发送到两个不同的目的地.

我的问题是,对于同一件事,它们具有不同的字段名称.例如,crm的名称为"firstname",付款网关的名称为"name_first".尽我所能,我根本无法弄清楚如何将它们结合起来.如果我将两者都放在一行中,那是错误的(例如name ="name_first" name ="firstname"),Dreamweaver会激烈地诅咒.此外,当我单击提交"时,只有放在最前面的信息(在本例中为name ="name_first")到达并更新其目的地,即付款网关.第二位不会更新数据库(crm).如果我将两者颠倒,则相反的情况发生.

我可以使用任何代码,php或javascript来实现此功能吗?

提前感谢

Hello

I''m not clued up with serious code (as yet), and I have a form which, when submitted, must update data in a crm and take the user to the payment gateway. I have pretty much worked out how to send it to the two different destinations, thanks to help on this website.

My problem is that they have different field names for the same thing. For instance, the crm has name="firstname" and the payment gateway has name="name_first". Try as I may, I simply cannot work out how to combine them. If I put both in one line, which is wrong, (like name="name_first" name="firstname"), Dreamweaver curses vehemently. Besides, when I click submit, only the info placed first (in this case name="name_first") reaches and updates its destination, the payment gateway. The second bit doesn''t update the database (the crm). If I reverse the two then the opposite happens.

Is there any code, php or javascript that I can use to get this working?

Thanx in advance

推荐答案

我在对问题的评论中开始回答.请先看.我试图解释这个问题是人为的.这应该不是问题.看一下表单的HTML源:每个字段应具有唯一的name.可能您错过了一些东西.您不应该像蒙住眼睛一样尝试这种操作,而应该检查表单(和HTTP标准)以查看其中的内容以及期望的HTTP消息.

我不知道你的项目是什么.您可以使用C ++,C#(在Mono下, http://en.wikipedia.org/wiki/Mono_% 28software%29 [ ^ ], http://www.mono-project.com/Main_Page [ http://www.php.net/manual/en/class.httprequest.php [ ^ ],
http://www.php.net/manual/en/class.httpmessage.php [ ^ ].

使用JavaScript,您可以使用Ajax.但是,如果您使用的是Ajax,那么您将JavaScript与HTML一起使用,并且如果您使用的是HTML,则可以使用与问题中提到的形式完全相同的形式.因此,我不知道您的应用程序,也不知道为什么要使用HTML或JavaScript进行操作.但是,如果出于某些原因需要执行此操作,请参阅:
http://www.w3schools.com/ajax/ajax_intro.asp [ http://www.w3schools.com/jquery/jquery_ref_ajax.asp [ http://api.jquery.com/category/ajax/ [ http://en.wikipedia.org/wiki/Ajax_%28programming%29 [ ^ ],
http://en.wikipedia.org/wiki/Ajax_framework [ http://www.dmoz.org/Computers/Programming/Languages/JavaScript/Ajax/ [ ^ ],
http://www.xul.fr/en-xml-ajax.html [ ^ ];

http://en.wikipedia.org/wiki/JQuery [ http://docs.jquery.com/Main_Page [
I started to answer in my comment to the question. Please see it first. I tried to explain that the problem looks artificially. It should not be a problem. Take a look at the HTML source of the forms: each field should have unique name. Probably you missed something. You should not try this and that like a blindfolded, but you should inspect the form (and HTTP standard) to see what''s in there, what HTTP message is expected.

I don''t know what your project is. You could do it in C++, C# (under Mono, http://en.wikipedia.org/wiki/Mono_%28software%29[^], http://www.mono-project.com/Main_Page[^]), JavaScript (but then you need to have your own HTML page; I have no idea where, in what application; and it can work only if you find it appropriate to do it on the client side), PHP (but then you should have your own Web site with PHP setup and do it on server side)), and a lot more.

With PHP approach, you would use HttpRequest and HttpMessage:
http://www.php.net/manual/en/class.httprequest.php[^],
http://www.php.net/manual/en/class.httpmessage.php[^].

With JavaScript, you can use Ajax. However, if you are using Ajax, you are using JavaScript with HTML, and, if you are using HTML, you could use exact same form you mention in your question. So, I don''t know your application and have no idea why doing it in HTML or JavaScript at all. However, if by some reason you need to do this, please see:
http://www.w3schools.com/ajax/ajax_intro.asp[^];
you can also use Ajax with jQuery:
http://www.w3schools.com/jquery/jquery_ref_ajax.asp[^],
http://api.jquery.com/category/ajax/[^].

See also:
http://en.wikipedia.org/wiki/Ajax_%28programming%29[^],
http://en.wikipedia.org/wiki/Ajax_framework[^],
http://www.dmoz.org/Computers/Programming/Languages/JavaScript/Ajax/[^],
http://www.xul.fr/en-xml-ajax.html[^];

http://en.wikipedia.org/wiki/JQuery[^],
http://docs.jquery.com/Main_Page[^].

—SA


这篇关于将表单信息发送到name ="firstname"和name ="name_first"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆