A "form" on the Web is considered to be zero or more form elements, plus a submit button. These forms are designed to electronically replicate the forms we've all filled in hundreds of times before in real life—signing up for a bank account, a passport, etc. You start your form using the
<form> HTML tag, and you end with
</form>. By separating forms like this, you can have multiple forms on one page.
Given the above definition, here is the most basic form in HTML:
<form> <input type="submit" /> </form>
That will simply show a button with "Submit" written on it, which will not submit any data when clicked. Figure 9-1 shows how it looks in Konqueror running on Linux:
Figure 9-1. The most basic form is just a Submit button by itself
There are two attributes to the
<form> tag that you should be aware of and use:
Action sets the location of the page that will handle the results of the form—the place where the variables should be sent.
Method describes how the data should be submitted, and you have two options:
When defining the method a web browser should use to send variables to the page specified by your action, you either use
POST. Both send variables across to a page, but they do so in different ways.
GET sends its variables in the URL of your visitors' web browsers (shown in Figure 9-2), which makes it easy to see what ...