Login    New User    Forgot Password    Help      

HTML Forms

GO TO INDEX

HTML Forms are used to select different kinds of user input.

How does an HTML form work?

A web form has two parts: the HTML ‘front end’ and a back end form processor. The HTML front end part handles the presentation while the back end handles the form submissions (like saving the form submissions, sending emails etc).
The back end form processor script is usually written in languages like PHP, ASP or Perl.

The image below illustrates the concept:

  1. A visitor visits a web page that contains a form.
  2. The web browser displays the HTML form.
  3. The visitor fills in the form and submits
  4. The browser sends the submitted form data to the web server
  5. A form processor script running on the web server processes the form data
  6. A response page is sent back to the browser.

The HTML form tag

All the input elements should be enclosed within the opening and closing <form> tags like this:

<form>

The input elements go here….

</form>

The following are the attributes of the form tag:

action=”Link to the form processor script”
The action attribute points to the server side script (the ‘back end’) that handles the form submission. Usually, this will be a script (PHP,ASP, Perl) or a CGI program

method =get|post ( either GET or POST)
In simple terms, if you use GET method, the form submission values are passed as part of the URL. If it is POST, the information is sent to the server as part of the data body and will not be visible in the URL box in the user’s browser.
If you don’t specify the method, GET is taken by default.

GO TO INDEX