[英]Passing form data from asp file to php
I have a form in an ASP file that I would like to pass to a php script for processing. 我在ASP文件中有一个表单,希望将其传递给php脚本进行处理。 Is this possible?
这可能吗? I don't see why it wouldn't be, but I tried a dummy form on an asp file, with the action="phptest.php" and when submitting it just reloads the form page.
我不明白为什么会这样,但是我在asp文件上尝试了一个虚拟表单,并添加了action =“ phptest.php”,提交时只是重新加载了表单页面。
The data being passed to your PHP script will be coming from an HTML form. 传递给您的PHP脚本的数据将来自HTML表单。 That the form was created with an ASP script will have no bearing so long as the output of your ASP script is a regular HTML form .
只要您的ASP脚本的输出是常规HTML表单 ,使用ASP脚本创建的表单就没有任何意义。
That submitting your form reloads the page suggests the HTML for the form is not correct for your needs. 提交表单会重新加载页面,这表明表单的HTML不符合您的需求。
You're dealing with a moderately complex scenario and in order to identify the cause of the problem you need to break things down into more simple components and test/examine these individually. 您正在处理一个中等复杂的场景,为了确定问题的原因,您需要将事情分解为更简单的组件并分别进行测试/检查。
Let: 让:
Insofar as I understand the scenario: 就我所了解的情况而言:
This suggests the following general problems: 这表明存在以下一般问题:
Work backwards from your ultimate goal (that being the correct processing of data by your PHP script). 从最终目标(即通过PHP脚本正确处理数据)开始倒退。 Check each step along the way and make sure it really is as you need.
检查过程中的每个步骤,并确保它确实是您所需要的。
action
attribute to the PHP script's URL. action
属性设置为PHP脚本的URL。 The form will now submit data to your PHP script. So long as you can get an HTML form submitting data to your PHP script, and so long as your PHP script correctly handles the incoming data, you can go ahead and then have the form generated by ASP. 只要您可以获得将数据提交到PHP脚本的HTML表单,并且只要您的PHP脚本正确处理了传入的数据,就可以继续进行操作,然后由ASP生成该表单。
That should definitely work. 那绝对应该工作。 Are you sure the form button is <input type="submit">?
您确定表单按钮是<input type =“ submit”>吗?
Are you sure the phptest.php is in the right directory? 您确定phptest.php在正确的目录中吗?
What happens if you go to the URL for the phptest.php directly? 如果直接转到phptest.php的URL,会发生什么情况?
Can you update your question with at least the HTML for the <form> tag and the <input> tags? 至少可以使用<form>标记和<input>标记的HTML更新您的问题吗?
您是否将操作放入了Submit标签或form标签中?
can you post the code here? 您可以在此处发布代码吗?
I would like recommend JSON to pass as "standar" ( http://ar.php.net/json_decode ) 我想推荐JSON作为“标准”传递( http://ar.php.net/json_decode )
First, is this ASP.Net, or Classic ASP? 首先,这是ASP.Net还是经典ASP? if it is ASP.Net, you need to remove the runat=server from your form tag.
如果是ASP.Net,则需要从表单标记中删除runat = server。 Also, you will need to use HTML tags, instead of ASP.Net form tags... ex: INPUT instead of ASP:TEXTBOX etc.
另外,您将需要使用HTML标记而不是ASP.Net表单标记...例如:INPUT而不是ASP:TEXTBOX等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.