Forms Course


Let's Identify The Fields

The INPUT TYPE of TEXT will produce a text box to allow the user to input some text in a field. This can be used for adding a name, address, city, state, etc. to the form, or any other type of single lined infomation that you would like to gather from the user. You can have as many of these fields as you would like.

Here is the line of code for TEXT INPUT:

<INPUT TYPE="text">

Next we must add an identifying NAME to this field.

Note: Each new TEXT field needs it's own unique NAME. This will be submitted with the form and seen in what you receive next to the senders contents of that TEXT field.

The NAME is a description of what the field(s) contain. For example "address of sender" or "name of sender".

<INPUT TYPE="text" NAME="descriptive text">

Now let's add a SIZE to this TEXT field.

<INPUT TYPE="text" NAME="descriptive text" SIZE="15">

Let's take a look at what that will produce:

You can also add a VALUE to put some default text into that text box and a MAXLENGTH to limit the the number of characters the user can input. These are optional attributes that can be added or not.

Here is a example code with those attributes added.

<INPUT TYPE="text" NAME="descriptive text" SIZE="15" VALUE="Hi There !" MAXLENGTH="100">

This is how our form code looks at this point.

<INPUT TYPE="text" NAME="descriptive text" SIZE="15">