• Home
  • »
  • HTML
  • »
  • Creating web page forms

Creating web page forms

HTML forms are popular for collecting information from the user, so online forms are used for user's input. Before we start creating forms, you need to be aware of how forms are processed on the web. To collect information from a user, you need to:

  1. use HTML code to create the form with the information you are requesting the user to provide
  2. use a web programming language (such as ASP, PHP, Perl, etc.) to process that form

By using HTML, you can only create a form. To collect (or process) the information from a form, you will need to use a web programming language. To create a form use the <form> tag and use </form> tag to end the form. (Click here to learn more about creating a <form> tag.) Between the <form> and </form> tags, you specify the form elements (see table 1). For details about a creating a specific element, simply follow the link for that element under "Field type" below.

Table 1 common form elements
Field type HTML tag to use Description Appearance in browser
Input (text) box <input type="text"> Single line text box for users to enter single line of data
Password box <input type="password"> Single line text box that hides the text being typed.
Radio Button <input type="radio"> Allows the user to select a single option from a predefined list
Check Box <input type="checkbox"> Allow the user to select zero, one or more options
Selection list <select>
<option>Option 1</option>
<option>Option 2</option>
Drop-down list box - displaying a long list of options
Text area <textarea rows="5" cols="15"></textarea> A (scrollable) text box used for extended entries that might include several lines of text
Submit button <input type="submit"> A submit button submits (sends) the form to the web server for processing.
Reset button <input type="reset"> Clears the data user has entered into the form.