Passing form data from asp file to php

I have a form in an ASP file that I would like to submit to a php script for processing. Is it possible? I don't understand why it won't, but I tried a dummy form in an asp file, with action = "phptest.php" and when submitting it just reloads the form page.

0


source to share


5 answers


The data passed to your PHP script will come from an HTML form. The fact that the form was created with an ASP script will have nothing to do with as long as the output of your ASP script is a normal HTML form.

When you submit your form, a page reload suggests that the HTML for the form is not appropriate for your needs.

You are dealing with a moderately complex scenario and in order to determine the cause of the problem, you need to break things down into simpler components and test them yourself.

Let be:

  • [A] = ASP script
  • [B] = HTML Form
  • [C] = PHP script

As I understand the scenario:



  • [A] generates [B]
  • [B] sends data to [C]

This indicates the following general problems:

  • [A] generates incorrectly [B] (your ASP is rendering incorrect HTML)
  • [C] does not correctly process the incoming form data (boolean error in your PHP script)

Work backwards from your end goal (this is correct data handling with your PHP script). Check every step along the way and make sure it really is the way you want it.

  • Go through your PHP code. Make sure it looks right at the moment. Pay attention to the PHP script url.
  • Create your HTML form manually. Set the attribute action

    to the PHP script url. The form will now submit data to your PHP script. Check that the PHP script does what it needs to do. Until you get this job, you cannot proceed.
  • Make your ASP script output the same HTML that you manually generated.

As long as you can get an HTML form submitting data to your PHP script, and as long as your PHP script correctly processes the incoming data, you can proceed and then create an ASP generated form.

+2


source


This should definitely work. Are you sure the form button is <input type = "submit">?

Are you sure phptest.php is in the correct directory?



What happens if you go directly to the url for phptest.php?

Can you update your question with at least HTML for the form <form> tag and <input> tags?

0


source


Did you put the action on a submit tag or on a form tag?

0


source


can you post the code here?

I would recommend JSON pass as "standar" ( http://ar.php.net/json_decode )

0


source


First, is it ASP.Net or classic ASP? if it's ASP.Net you need to remove the server runat = from the form tag. Also, you will need to use HTML tags, not ASP.Net form tags ... ex: INPUT instead of ASP: TEXTBOX, etc.

0


source







All Articles