Quick Guide to Forms

Bill Wake, 6-30-95

Tags for Forms

You put a form on a normal HTML page:
<form method="POST" action="script-name">
Put the form components here.
  • Text:
    <INPUT TYPE="text" NAME="field-name" VALUE="initial-string" SIZE="nn" MAXLENGTH="nn">
    VALUE, SIZE, and MAXLENGTH are optional; default to "", 20, and infinity, respectively.
  • Password text:
    <INPUT TYPE="password" NAME="field-name" VALUE="initial-string" SIZE="nn" MAXLENGTH="nn">
    VALUE, SIZE, and MAXLENGTH are as for "text"; note that the VALUE field can be viewed by the user.
  • Hidden text:
    <INPUT TYPE="hidden" NAME="field-name" VALUE="initial-string">
    This value doesn't show up on the screen at all, though it is visible via "View Source", and is returned in the document.
  • Multi-line text:
    <TEXTAREA rows="nn-required" cols="nn-required">
    Default text
  • Binary selection:
    <INPUT TYPE="checkbox" NAME="box-name" VALUE="value-if-on" CHECKED>
    The VALUE option defaults to "on". The CHECKED option sets the initial state.
  • Pop-up button:
    <SELECT NAME="button-name">
    <OPTION VALUE="one-word-string" SELECTED>Text of option
    <OPTION>Another option
    The VALUE is really only needed if the text is not one word; if it is, the text of the option is sent directly. Only one SELECTED should be on an OPTION (defaults to first).
  • Radio button:
    <INPUT type="radio" NAME="button-name" VALUE="value" CHECKED>
    The NAME option ties pieces of a single button together. VALUE should be unique for each option (of a particular button). CHECKED should be used for exactly one option.
  • Multiple selection scrolling list:
    <SELECT NAME="listname" MULTIPLE SIZE="nn-lines">
    <OPTION>As before
    If MULTIPLE is present, it allows more than one to be selected. SIZE tells how many lines scrollbox should have. Multiple selected items will be passed back with the same name (so script should detect this).
  • Image coordinates:
    <INPUT TYPE="image" SRC="gif-location" NAME="prefix">
    The NAME prefix is prepended to generate names prefix.X and prefix.Y. The upper left corner is (0,0).

Interacting with the server

  • Reset button:
    <INPUT type="reset" VALUE="button-name">
  • Submit button:
    <INPUT type="submit" NAME="name" VALUE="button-name">
    NAME is optional and can be used to allow multiple SUBMIT buttons.

Other Information

  • Information on CGI scripts
  • Sample .htaccess file:
       AuthUserFile /dev/null
       AuthGroupFile /dev/null
       AuthName ExampleAllowFromNCSA
       AuthType Basic
       <Limit GET>
       order deny,allow
       deny from all
       allow from .ncsa.uiuc.edu

Copyright 1994-2010, William C. Wake - William.Wake@acm.org