HTML : Forms Quick Reference


FORM Tag

<form action="url" method="get"> </form>

  action: URL to receive the contents of the form
  method: how to submit the form, eg. get, post

Submit/Reset Buttons

<form action="1014.html"> <input type="submit" text="Go!" value="search"> <input type="reset" text="do over." value="redo"> </form>

  type:  submit or reset
  text:  text to send with the form
  value: text to appear on the button

Text Fields

<form action="1014.html"> <input type="text" name="name" value="value" size="size"> </form>

  type:  text
  name:  name of the field to submit
  value: default value to fill in the form
  size:  field width on the form

Hidden Fields

form action="1014.html"> <input type="hidden" name="name" value="value" size="size"> </form>

  type:  text
  name:  name of the field to submit
  value: default value to fill in the form

Selection Lists

<form action="1014.html"> <select name="book"> <option value="Dictionary" selected>Dictionary <option value="Thesaurus">Thesaurus </select> </form>

  name:  name of the field to submit
  value: value to fill in the form

Use 'selected' to default a value into the form.

Can vary 'value' vs. text displayed; 'value' is what the CGI will see.

Radio Buttons

Male Female

<form action="1014.html"> <input type="radio" name="sex" value="M" checked>Male <input type="radio" name="sex" value="F">Female </form>

  type:  radio
  name:  name of the field to submit
  value: default value to fill in the form

Checkboxes

TV DVD VCR

<form action="1014.html"> <input type="checkbox" name="tv" checked>TV <input type="checkbox" name="dvd" checked>DVD <input type="checkbox" name="vcr">VCR </form>

  type:  checkbox
  name:  name of the field to submit
  value: will be 'on' or 'off'

Textarea

<form action="1014.html"> <textarea rows=4 cols=50 name="freetext"></textarea> </form>


keywords: hypertext markup language
date: 08/01/2005