| forms - form |
|
text textarea buttons image < form > e-mail form checkbox radio select password hidden layout cgi tags epilogue |
The form tag has several attributes. The main is ACTION, which
determines what will be done with the contents of the form. Another is METHOD,
which determines how a form is submitted. Also worth mentioning is the TARGET
attribute. This is used if you want to open the results in another frame
or window.
<FORM ACTION="forms.cgi">
Action <FORM ACTION="mailto:[email protected]"> If your browser accepts this action, it will send the contents of the form to the specified e-mail url, in a readable format. Be aware however, that several browsers do not seem to support this feature. On the next page you will find the complete code for such a form, and an example of how that form will look. <FORM METHOD="GET">
Method http://www.thedragonslayer.tk/submit.pl?name=value&name=value
URL encoding <FORM ENCTYPE="text/plain"> A form is normally sent url-encoded. If you specify an encode type, the form data will be sent more or less unencoded. The result of the form will be more readable, if sent as an e-mail form, like the one on the next page. Only use this one in a mailto: form however, a cgi script may have trouble decoding this. Also older browsers may not understand this attribute. <FORM METHOD="POST"> A bit different is the method POST. In this case the url will just be what you specified in the ACTION. The data are transferred seperately, after calling the url. This will result in a cleaner url in the location box. You will see no data there, just a basic url. This is the preferred method with programmers. It is also necessary to make our little e-mail form work properly. One final puzzle for you. What happens if you don't specify any attributes? Just a plain <FORM> tag? Well, the form will be submitted to itself. What's the use of that, you might ask. Forms are often generated by a program, or "on-the-fly". This program often also handles the output of the form. If there are errors, the form can be displayed again, with error messages at the appropriate locations. <FORM ACTION="http://www.thedragonslayer.tk/forms/forms.cgi">
Testing your own forms |