This website may use cookies. More info. That's Fine x
Welcome Login

form tag

Using forms:

A form is a container for input elements: buttons, checkboxes, text inputs etc.

It's the input elements in a form that enable a user to enter information into a page and submit information to a server.


form tag:

form tag is used to create an html form for user input(s).

form element can contain one or more of the following form elements:

  • input
  • textarea
  • button
  • select
  • option
  • optgroup
  • fieldset
  • label



action attribute:

Action attribute tells  browser where to send the information, so the action contains a url.

The url can be relative, or in cases where you want to send information to a different application or a different server.  The action url can also be an absolute url.


method attribute:

Method attribute tells the browser which method to use: http get or an http post, when sending the information.

The default method value is "get", so a form sends an HTTP GET request is sent by default.





<form action="contact.aspx" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">




For more information on get and post, click here.

Created on: Wednesday, November 7, 2012 by Andrew Sin