Forms in HTML

From Wikiversity

Jump to: navigation, search

Forms are normally used to submit information across the internet by the user browser and is commonly known as the Client.

The form tag

  <form>...</form>

Contents

[edit] Form Attributes

1. action specifies the destination of the information being sent

2. method

  • Specifies the way the information has to be sent
  • Two methods - POST and GET

[edit] Form Elements - Input Tag

1. Text fields

  <input type="text">

2. Password

 <input type="password">

3. Check box

  <input type="checkbox">

4. Radio button

  <input type="radio">

5. Submit button

  <input type="submit">

6. Reset button

  <input type="reset">

7. Other button

  <input type="button">

8. Image working like submit botton

  <input type="image" src="" name="submit">

[edit] Attributes of Input tag

1. name - associated with a text field

2. size - length of characters in an input field

3. checked - For check box

4. max length - maximum characters allowd

5. value - For text and password field, value is the text that has been typed - Radio button and check box - Submit and Reset button - values used to display text on a button

[edit] Text Area Tag and Attributes

  <textarea>...</textarea>

Attributes:

  • name
  • wrap = physical - to allow words to wrap in text area
  • height and width
  • cols and rows

[edit] Drop Down

  <select>
    <option>...</option>
  </select>

Attributes:

  • name
  • size - number of items to be displayed at one time
  • multiple select
  <select multiple>...</select>
  • Selected
  <option selected>...<option>

Shameem 17:04, 22 July 2007 (UTC)