LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   HTML Form action: post to self (https://www.linuxquestions.org/questions/programming-9/html-form-action-post-to-self-4175535560/)

linux_walt 03-02-2015 01:43 PM

HTML Form action: post to self
 
Hello, I have been reading up on what happens when a form's action is set to 'self'. As I understand it, after hitting the 'submit' button, the form's information is sent back to the server, along with the 'action' information, which in this case would be 'pass on the form information to the same page that contains the form'.

What I'm not clear about is what happens next.

Does the server send a fresh copy of the html page that contains the form, along with the submitted form information?

Does the server send back only the form's information, and the browser refreshes the page locally, attaching to it the form's information sent to it by the server?

Does the browser know that the form is posting to the same web page, and not send anything to the server, just reloads the page, making the form's new data available?

Thanks!

michaelk 03-02-2015 03:01 PM

The web page is actually a script or CGI program. When you press the submit button the script is called with arguments similar to running a bash script in a console i.e myscript arg1 arg2 etc. It would then parse the arguments i.e form data, do what ever it is supposed to do and then create the web page to display some sort of results. The browser expects a new page. The content is created dynamically by the server.

http://en.wikipedia.org/wiki/Server-side_scripting

I assume that the web page does not contain any JavaScript.
http://en.wikipedia.org/wiki/Client-side_scripting

linux_walt 03-02-2015 04:42 PM

Thanks Michael. So after hitting the 'submit' button I am looking at a new page from the server. For some reason this is not made very explicit in how-to's regarding this topic.

I have a small amount of java code in the page, but it's only to detect if the user has changed the selection in a drop down selector.


All times are GMT -5. The time now is 05:25 AM.