Top Nav

Your how-to site for community journalism

Creating Forms Module: The input Tag

Creating Forms: The Input Tag

Creating Forms

The <input /> Tag

Now that we’ve defined where the form begins and ends, and specified what it will do with the information it gathers, it’s time to create the inputs that will collect that information from the user.

The basic input tag is a stand-alone tag, and looks like this:

<input />

There are two attributes that every input tag must have. The first is a name. Depending on how they’re written, scripts and programs that work with forms will handle different parts of that form in different ways. Labeling each input in a form with a name attribute will help keep those scripts from getting confused about which bit of information is the user’s login name and which is the user’s password, for example. You’ll need to know beforehand which labels a script will be looking for, and name the inputs in your form accordingly.

The shape an input tag takes, and the kind of information it collects, is determined first and foremost by its type attribute. We’ll now go through the different types of input tags, explaining what each one is best used for.

Powered by WordPress. Designed by Woo Themes