The Form Tag

27 05 2008

The form tag, obviously, creates a form within a website. Those forms contain textfields, radio buttons, checkboxes, and other elements that a user can manipulate and finally submit to communicate with a server, send a search request and many other things. Here’s an example that contains the typical elements of a form, Simple Form Example.

If you take a look at the source code you’ll notice that form action tag contains the url where the form data is being send to. As I said the before, it’s a very basic form, the only tricky part (not really but I had some problems with that way back) is that if you have radio buttons and you want the user to be limited to make only one selection (otherwise you’d use checkboxes) make sure that the “id” is the same except for a number counting upwards for every possible selection:

…id=”Selection_1″
…id=”Selection_2″

If the id’s not matching the form will allow users to make more than one selection. If you want to learn more about forms simply check out a tutorial website like Pixel2Life and try one of the PayPal form tutorials. They contain a lot of different issues and have “real world” touch.