HTML/Forms

(Redirected from Forms in HTML)

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>

Form Attributes

edit

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

Form Elements - Input Tag

edit

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 button

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

Attributes of Input tag

edit

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 allowed

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

Example of form with input tag to send text by URL

edit
<!doctype html>
<html>
  <form>
    <input name="myURL" type="text">
    <button>Submit</button>
  </form>
</html>

Text Area Tag and Attributes

edit
  <textarea>...</textarea>

Attributes:

  • name
  • wrap = physical - to allow words to wrap in text area
  • height and width
  • cols and rows
edit
  <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)


Further reading

edit
  • W3.org: "Forms" is the official reference.[1]



Learning HTML
Previous: Frames in HTMLNext: Web Design/HTML Challenges