In the early days of the internet, HTML Forms were designed to be processed by the server : meaning there had to be interaction between your computer and the remote machine storing the form and response code.
Server based HTML Information processing
GET
andPOST
are the two HTML methods of server side HTML FORM PROCESSING, of transmitting information from on page to the next. In both cases, all form variables are all transmitted automatically.
they are defined by theMETHOD
argument of the HTMLFORM
element
GET Method
- sends form content via url query string parameters. Allows copy of the transmitted variables via url, or duplication via copy and paste of the URL. Values are encoded, meaning some characters are transformed following the percent-encoding rule, which encodes specials characters to percent prefixed codes.
This method suffers manby security related issue - user can resubmit info without warning from the browser, risk of involontary multiple submission
- data is easily copied and pasted from the url , which can be good for debugging purpose but dangerous in production scenario
<form name="myFirstForm" action="confirmation.php" method="get">
</form>
POST Method
- sends form content embedded within the request. Cannot be duplicated without manual submit
- requires server side (PHP in our case) processing
Basic Form 1 : POST
<form name="myFirstForm" action="confirmation.php" method="post">
</form>
Evolution of HTML forms with browser based processing and AJAX
- Javascript can manipulate form data, AJAX sends them to the server for storing, data processing, and sending response to the browser
- stands for Asynchronous JavaScript + XML
- Send query to server via Javascript calls, receives XML,HTML, or JSON data top be processed via Javascript
- Allows development of interactive interface with server database