Form Submission and Response Handling

Discussion in 'PHP' started by Peham, Sep 24, 2012.

  1. #1
    Hi,

    I have a form that is to be submitted to a remote server, when the form is submitted, the remote server gives a xml response. what i want to do is, enter the form data into the database, and forwarding the data to remote server. When the form is submitted instead of xml response i want to show a html success page.

    The issue is when we submit the form the response is a xml file at remote server. I don't want a user to view that file. Is there a way to forward the form data without going to that server? Simply forwarding the data to the server and rewriting the response without getting redirected by the remote server to xml file?

    Urgent response will really be appreciated.

    Thanks
     
    Last edited: Sep 24, 2012
    Peham, Sep 24, 2012 IP
  2. YoEli

    YoEli Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The simple answer is yes, you could use Ajax to submit the form and use a callback to redirect anywhere you like after success. It's fairly easy to do with jQuery or most other JavaScript libraries. :)

    Let me know if you need any help, but without much more information it's hard to be specific. Look up "jQuery ajax form submit" on Google and it should give you a good starting point.

    Eli
     
    YoEli, Sep 24, 2012 IP
  3. Peham

    Peham Greenhorn

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #3
    Hi, thank you for your reply. let's suppose, we are submitting the form from mysite.com/myform.html to a url, somesite.com/formrecieved.php. The url in response only gives XML response.

    when this XML says successful i want to give a success message, when it says fail i want to create a fail message. The above xml response is on the same url somesite.com/formrecieved.php

    hope you have understood what i want to do.
     
    Peham, Sep 26, 2012 IP