PDA

View Full Version : [SOLVED] html form submission



zobayer1
May 23rd, 2011, 10:28 AM
Hello, I am trying to create a submission page, which will submit to some other page. When I use <form> after submission, the page redirects to the action page I mentioned. But I want to stay on my current page as submit as well. What can I do?
Thanks in advance and if I am not clear, then please mention, I will try to explain further.

s.fox
May 23rd, 2011, 10:33 AM
Hello,

I would set the action to the current page written in a server side language. Run a test to see if the post data is available and if so process it, otherwise display the form.

-s.fox

r-senior
May 23rd, 2011, 10:39 AM
What language are you processing the form data with on the server? Java/JSP? php? Something else?

zobayer1
May 23rd, 2011, 10:43 AM
I would set the action to the current page written in a server side language. Run a test to see if the post data is available and if so process it, otherwise display the form.

Thanks s.fox for your quick reply. Here is what I am trying to do actually:

Say, I have a page mydomain.com/submit.php and I am sending the data to otherdomain.com/submit.php and I have no control on otherdomain.com pages. After submission, my submit.php will load otherdomain's submit.php (well, not necessarily it is always a php file), but I want to stay in my submit.php instead of going anywhere and submit data as well.

zobayer1
May 23rd, 2011, 10:45 AM
What language are you processing the form data with on the server? Java/JSP? php? Something else?

I am not processing the data, I am sending it to an external form, probably they process it with perl.

r-senior
May 23rd, 2011, 10:54 AM
You could do that with an AJAX submit:

http://stackoverflow.com/questions/1960240/jquery-ajax-submit-form

Your AJAX call can get the response from the other server and you can report that in your page as you wish (typically by parsing the response and then changing the body of a node in your page).

s.fox
May 23rd, 2011, 10:57 AM
I did not realise you were posting to another domain. On that basis I agree with r-senior, ajax can help you here. :)

zobayer1
May 23rd, 2011, 11:02 AM
Thanks s.fox and r-senior, let me try that :)
Actually, I like programming problem solving and I use to solve on various online-judges, so If I could create a page from where I can submit on all the sites according to my wish, then it would be interesting.
:)

SeijiSensei
May 23rd, 2011, 02:13 PM
You could also post the information in the background using the CURL (http://www.php.net/manual/en/intro.curl.php) extensions to PHP, parse the result, then display an appropriate local result page.

zobayer1
June 2nd, 2011, 05:17 PM
You could also post the information in the background using the CURL (http://www.php.net/manual/en/intro.curl.php) extensions to PHP, parse the result, then display an appropriate local result page.

Thanks that worked for me :D