Contents [*] Form filling [*] Simple forms [*] Multiple elements [*] Multiple lines of input [*] Check boxes [*] Radio button [*] Pop up list [*] Reset values [*] Image maps [*] Hidden form element ------------------------------------------------------------ Warning if you are not using a browser that supports tables such as Netscape 1.1 or later then this page will probably be very difficult to read. ------------------------------------------------------------ [Index] Form filling A web page can request input from the user who is browsing the page. After the user has finishing filling in the form, the entered data is sent to a CGI (Common Gateway Interface) script for processing. The CGI script returns as its result a text stream representing a web page. This web page contains all the normal text plus markup tags of a conventual web page. The only difference is that it is prefixed with the text: Content-type: text/html A form is introduced by the tag
and terminated by the inverse tag
. The attributes of the
tag include: ACTION="http://host/cgi-bin/script_name" After the form has been filled in, the entered data is sent to the named CGI script for processing. The script is confined to being in the cgi-bin directory or nominee. The location of the cgi-bin directory is defined by the web administrator. [Index] Simple forms A form to request the user to enter text which is to be sent to the CGI script mas_form is shown below. This is introduced by the tag. Generated form HTML markup required
To activate the CGI program enter textual information into the text box and then press "Enter" on the keyboard. The input data is sent to the CGI script in the form: name=Your+name The attributes of the tag include: NAME="name" Names the argument which is sent to the CGI script VALUE="Your name" The value of the argument. SIZE=20 The width of the input area. [Try it] In sending the data to the CGI script there are various character mappings of the input data to ease later processing. For example: Input character Sent to CGI script Input character Sent to CGI script space + % %25 = %3D & %38 Line Feed %0A Carriage Return %0D Note: How some input characters are represented by their hexadecimal representation. Which is indicated by the sequence %HH, where H is a hexadecimal digit. A form to request a password or any secret text to be entered is: Generated form HTML markup required
Warning: This is not secure, unless the data is encrypted before being sent over the internet. Even if it is encrypted, the encryption may still be broken. [Try it] ----------------------------------------- ------------------------------------------------------------ ----------------------------------------- [Index] Multiple elements More specialized forms can be designed, which contain multiple elements. In these forms an additional tag is used to cause the submission of the input data to the CGI script. The attribute TYPE="submit" identifies the type of input action. For example, the
tag encloses an tag of the form: Which when pressed will send in addition to any information entered in the form the additional message button=Send. There may be several of these input tags with in a form. The VALUE attribute identifies which tag has been selected. For example, the form below is composed of several buttons. Generated form HTML markup required
Which when a button is pressed will send a message of the form: button=+A+ to the CGI script if button "A" is pressed. [Try it] ----------------------------------------- ------------------------------------------------------------ ----------------------------------------- [Index] Multiple lines of input text A form to request the user to input multiple lines of input uses the
Note: As there may be many input lines there is an inverse tag to signify the end of the initial value. The attributes of the