229 users online (0 members and 229 guests)  

  HTML Form Tag

Forms start with the <form> tag, which tells the browser where to send the information, then they have a few input fields, then a usually a submit button and a reset button.

Let's get started.

As stated above, this tag starts the form. Here is an example use of the <form> tag:

<form action="http://www.geocities.com/cgi-bin/homestead/mail.pl?yourname" method="post">

This code will not show up in the web page, it's invisible. It is the "input types" that you put in your code that create the visible part of your HTML form, with the exception of input type hidden.

  • form * - tells the browser that the next section of the web page will be a form

  • method * - tells the browser how to send the information (possible values: post is the most often used, and there are a few others)

  • action * - tells the browser where to send the information (the one shown is a mailto: form, and sends it to an e-mail address. Otherwise, they are usually sent to a location)

  • enctype - this is only used when the action attribute is mailto. This tells your e-mail client what type of e-mail it will be sending

* = mandatory

Forms are a little tricky, you must have a script that will take the information and do something with it. In the above example, Geocities is using a CGI script named mail.pl.

You've learned how to start a form, now lets learn the rest. There are seven kinds of input types: "text", "checkbox", "radio", "hidden", "password", "reset", and "submit". These all have different attributes to them; read about them by following the remaining HTML form tutorials. There is also another type of input, which creates a large window into which one can type text, but it is not a true "input type", this is called the textarea.

Back to the HTML menu.