I have a form in an ASP file that I would like to pass to a php script for processing. 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.
That should definitely work. Are you sure the form button is <input type="submit">?
Are you sure the phptest.php is in the right directory?
What happens if you go to the URL for the phptest.php directly?
Can you update your question with at least the HTML for the <form> tag and the <input> tags?
can you post the code here?
I would like recommend JSON to pass as "standar" (http://ar.php.net/json_decode)
First, is this ASP.Net, or Classic ASP? if it is ASP.Net, you need to remove the runat=server from your form tag. Also, you will need to use HTML tags, instead of ASP.Net form tags... ex: INPUT instead of ASP:TEXTBOX etc.
The data being passed to your PHP script will be coming from an HTML form. 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.
That submitting your form reloads the page suggests the HTML for the form is not correct for your needs.
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:
- [A] = ASP script
- [B] = HTML form
- [C] = PHP script
Insofar as I understand the scenario:
- [A] generates [B]
- [B] sends data to [C]
This suggests the following general problems:
- [A] incorrectly generates [B] (your ASP outputs the wrong HTML)
- [C] mis-handles the incoming form data (a logic error in your PHP script)
Work backwards from your ultimate goal (that being the correct processing of data by your PHP script). Check each step along the way and make sure it really is as you need.
- Go over your PHP code. Make sure it, for now, looks correct. Note the URL of the PHP script.
- Manually create your HTML form. Set the form's
action
attribute to the PHP script's URL. The form will now submit data to your PHP script. Test that the PHP script is doing what it should. Until you get this working you can't continue. - Make your ASP script output the exact same HTML as that which you created by hand.
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.