Home > Articles > Web Development > HTML/CSS

  • Print
  • + Share This

Design Heuristics for Great-Looking Forms

There are several reasons that our form looks ugly:

  • The controls and labels aren't aligned.

  • There's no color.

  • The labels are in a serif font (Times Roman) that's hard to read.

Let's fix all these problems, starting with the alignment. Our initial code looks like Listing 1.

Listing 1 Original Unformatted Guest Book Form

<FORM METHOD=POST ACTION="insert.asp">
Name: <INPUT TYPE=TEXT NAME=name SIZE=40><BR>
E-mail: <INPUT TYPE=TEXT NAME=email SIZE=40><BR>
<INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>Hide E-mail?<BR>
Age: <INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"><BR>
Gender: <BR>
<INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
<INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female<BR>
Comment: <TEXTAREA NAME=comment ROWS=5 COLS=40>
Insert a Comment Here
</TEXTAREA><BR>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

Aligning Controls and Labels Horizontally

Aligning controls and labels leads to a more professional-looking form. The easiest way to accomplish this alignment is by using <TABLE> and its related tags.

NOTE

The table we're creating won't look like a table in the form. The user won't even know it's there unless s/he looks at the source for the page. This invisible table just helps to align the controls.

  1. Add a <TABLE> tag right after the <FORM> tag and a </TABLE> closing tag before the code for the submit button.

  2. Set the <TABLE> tag's CELLSPACING and BORDER parameters to 0 (zero). The CELLSPACING parameter controls how much whitespace the users sees between cells. Setting CELLSPACING to zero means that you want no whitespace between cells. The BORDER parameter sets the thickness of the border around the cells in the table. Setting BORDER to zero removes the border around cells. Your code should now look like Listing 2 (the new stuff is bold).

  3. Listing 2 Adding <TABLE></TABLE> Tags

    <FORM METHOD=POST ACTION="insert.asp">
    <TABLE CELLSPACING=0 BORDER=0>
    Name: <INPUT TYPE=TEXT NAME=name SIZE=40><BR>
    E-mail: <INPUT TYPE=TEXT NAME=email SIZE=40><BR>
    <INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>Hide E-mail?<BR>
    Age: <INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"><BR>
    Gender: <BR>
    <INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
    <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female<BR>
    Comment: <TEXTAREA NAME=comment ROWS=5 COLS=40>
    Insert a Comment Here
    </TEXTAREA><BR>
    </TABLE>
    <INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
    </FORM>
  4. Add a <TR> before each label/control pair. This code indicates the beginning of a table row (thus the TR).

  5. Add a </TR> to the end of each label/control. This tag ends a table row.

  6. Remove any unnecessary break tags (any <BR> that comes immediately before or after a </TR> tag is unnecessary). Your code should look like Listing 3 (the new tags are bold).

NOTE

There's no requirement to put the <TR> and </TR> tags on separate lines. It's just a convention that makes the code simpler to read and comprehend.

Listing 3 Adding <TR></TR> Tags

<FORM METHOD=POST ACTION="insert.asp">
<TABLE CELLSPACING=0 BORDER=0>
<TR>
Name: <INPUT TYPE=TEXT NAME=name SIZE=40>
</TR>
<TR>
E-mail: <INPUT TYPE=TEXT NAME=email SIZE=40>
</TR>
<TR>
<INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>Hide E-mail?
</TR>
<TR>
Age: <INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18">
</TR>
<TR>
Gender: <BR>
<INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
<INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female
</TR>
<TR>
Comment: <TEXTAREA NAME=comment ROWS=5 COLS=40>
Insert a Comment Here
</TEXTAREA>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

<TR> and </TR> (short for table row) tell the browser where to start (and end) a new row when displaying a table. Within each row are columns of data, or data cells. You denote each cell in your table with a pair of <TD></TD> tags (the TD is short for table data). There are two cells per row in our example—one for the labels and one for the controls. Now follow these steps:

  1. Surround each text box label with a pair of <TD></TD> tags.

  2. Surround category labels (such as Gender) for radio buttons and check boxes with <TD></TD> tags.

  3. Add a <TD></TD> (the opening and closing tags, with nothing in the middle) before any radio button or check box that doesn't have a category label, such as the Hide E-mail? check box.

  4. Surround each text box or multi-line text box with <TD></TD>.

  5. Surround related groups of radio buttons and check boxes (along with their labels) with <TD></TD>.

  6. Remove any unnecessary <BR> tags.

These steps sound more complicated than they actually are to implement. Listing 4 shows the result, with the new tags in bold. For readability purposes, we put the labels and controls on separate lines, and indented each line four spaces. Although putting all your data cells on one line will indeed work, we find that doing so makes the table difficult to maintain if you have to make changes later on. Also note that we've removed the spaces after every label that we put in earlier, since the table tags now handle the spacing of labels and controls.

Listing 4 Adding <TD></TD> Tags

<FORM METHOD=POST ACTION="insert.asp">
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD>Name:</TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD>E-mail:</TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD></TD>
  <TD><INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
    Hide E-mail? </TD>
</TR>
<TR>
  <TD>Age:</TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD>Gender:</TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female
  </TD>
</TR>
<TR>
  <TD>Comment:</TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40>Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

Let's check to make sure the changes worked. Save the file and refresh the view in the browser (see Figure 42)

Figure 42 Browser: The Guest Book form with controls and labels horizontally aligned.

Notice that the Gender: and Comment: labels are centered in the middle of the radio buttons and comment box, respectively. These labels would look better if they were adjacent to the top of their corresponding control or control group (in the case of the radio buttons). Besides proper horizontal alignment of controls and labels, you may also need proper vertical alignment, as discussed in the next section.

Aligning Labels Vertically

To vertically align a label in a table, you use the VALIGN parameter (short for vertical align) inside a <TD> tag. VALIGN can take three values: TOP, CENTER (the default), and BOTTOM.

Ready to try it on your own? Place VALIGN=TOP in the <TD> tag for any label that's improperly centered in guestbook.html. Your code should look like Listing 5, where the changes are bold, as usual.

Listing 5 Adjusting the Vertical Alignment

<FORM METHOD=POST ACTION="insert.asp">
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD>Name:</TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD>E-mail: </TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD></TD>
  <TD><INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
    Hide E-mail? </TD>
</TR>
<TR>
  <TD>Age: </TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD VALIGN=TOP>Gender: </TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female
  </TD>
</TR>
<TR>
  <TD VALIGN=TOP>Comment: </TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40>Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

NOTE

Although we won't demonstrate it here, there's also an ALIGN parameter that horizontally aligns whatever is between a pair of <TD></TD> tags. ALIGN can take three values: LEFT (the default), CENTER, or RIGHT.

Let's check to make sure the changes worked. Save the file and refresh the browser (see Figure 43).

Figure 43 Browser: The Gender: and Comment: labels are now vertically aligned.

With the controls and labels properly aligned, the next change we want to make to improve the look of our form is adding color.

Adding Color

Don't pick arbitrary colors for your form. If you want your form to blend in smoothly with the rest of your site, you should use your site's color scheme. Your web site should have at least one dark color and one light color. To match the ProfessorF web site colors, we'll use maroon as our dark color and tan as our light color for this example. In general, when using colors to improve the look of a form, set the background color of the labels to the light color and surround the entire table with a border of the dark color (refer to Figure 14 to see what we're going to do).

To change the background color of a cell containing a label—a cell being the intersection of a row and a column in a table—you set the BGCOLOR parameter of the <TD> tag surrounding that label to some color value. In our example, we'll use TAN as the color value:

  1. Add BGCOLOR=TAN to every <TD> tag pair surrounding a label. Although the hideEmail CHECKBOX doesn't have a label, you still should put BGCOLOR=TAN inside the label cell so the browser will color that empty cell appropriately. (Note that some browsers, such as Netscape, may not color this cell even then, unless you put &nbsp;—the symbol for a non-blocking space character—between <TD BGCOLOR=TAN> and </TD> for that cell.) See Listing 6 for the new version of the code, with the new stuff in bold.

  2. Save the file and view the new version in your browser (see Figure 44).

Listing 6 Setting a Color for the Labels

<FORM METHOD=POST ACTION="insert.asp">
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD BGCOLOR=TAN>Name:</TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>E-mail: </TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN></TD>
  <TD><INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
    Hide E-mail? </TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>Age: </TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>Gender: </TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female
  </TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>Comment: </TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40>Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

Figure 44 Browser: Labels with a background color set.

Looking better! Next, we'll add a colored border around the entire table. Unfortunately, there's no parameter to draw a colored border around the outside of a table. Thus, we need to place our current table within another table—a one-cell table whose BORDERCOLOR parameter is set to the dark color:

  1. Add <TABLE BORDER=1 CELLSPACING=0 BORDERCOLOR=MAROON><TR><TD> just before the <TABLE> tag.

  2. Add </TD></TR></TABLE> after the </TABLE> tag. Listing 7 shows the changes in bold.

  3. Save the file and view the new version (see Figure 45).

Listing 7 Adding a Colored Border around the Form

<FORM METHOD=POST ACTION="insert.asp">
<TABLE BORDER=1 CELLSPACING=0 BORDERCOLOR=MAROON><TR><TD>
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD BGCOLOR=TAN>Name:</TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>E-mail: </TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN></TD>
  <TD><INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
    Hide E-mail? </TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>Age: </TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>Gender: </TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">Male<BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>Female
  </TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>Comment: </TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40>Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
</TD></TR></TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

Figure 45 Browser: A border appears around the form.

Ah. Our form is looking much improved. A change in font will make it look even better.

Changing Fonts

Some serif fonts, such as Times Roman, just don't look professional when used online—mainly because the serifs (the little "hooks and tails" at the tops and bottoms of each letter) make the text look fuzzy. If you check out most corporate and professional web sites, the bulk of the text is in a sans serif font such as Arial, Helvetica, or Verdana. To make our form look more professional, we'll change the font to a sans serif font, and make the labels smaller but bold.

NOTE

My editor insists that I clarify something about using serif versus sans serif type. Serif type is much easier to read than sans serif in large blocks of text. You shouldn't be using large blocks of text on your web site anyway, but if you need them, using a serif font will make my editor much happier. (Okay, Robin?)

To change the font, we'll use the <FONT> tag with the FACE parameter set to the Arial font. To change the font size to 9 point, we'll add the STYLE parameter set to font-size:9pt. (Don't use the SIZE parameter for this, as its value specifies a relative size, which is controlled by the user's browser settings. In this case, we're indicating a specific point size rather than a relative size.)

  1. Surround each label for a text box or check box/radio button category with <FONT FACE="ARIAL" STYLE="font-size:9pt"><B> and </B></FONT> tags.

  2. Surround individual radio button and check box labels with <FONT FACE="ARIAL" STYLE="font-size:9pt"> and </FONT> tags.

  3. Surround the labels with the <B></B> tags to make the labels bold. Time to check the code again (see Listing 8).

  4. Save and view your changes (see Figure 46).

Listing 8 Setting Labels to a Sans Serif Font

<FORM METHOD=POST ACTION="insert.asp">
<TABLE BORDER=1 CELLSPACING=0 BORDERCOLOR=MAROON><TR><TD>
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Name:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  E-mail:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN></TD>
  <TD>
  <INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Hide E-mail?
  </FONT>
  </TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Age:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Gender:
  </B></FONT>
  </TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Male
  </FONT>
  <BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Female
  </FONT>
  </TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Comment:
  </B></FONT>
  </TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40>Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
</TD></TR></TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</FORM>

Figure 46 Browser: All fonts are changed to Arial, a sans serif font.

Tweaking Text Box Sizes

Forms whose text boxes have uneven widths look sloppy. For example, in our guest book the comment box is wider than both the name and email text boxes, even though all of these controls hold 40 characters. The reason for the uneven widths is that the default font for <TEXTAREA> tags is wider than the default font for text boxes. You can fix this by setting the STYLE parameter in your <TEXTAREA> tags to the same font as your text boxes with "font-family:Arial":

  1. Set the STYLE parameter in your <TEXTAREA> tags to match the fonts in the text boxes by setting the font-family sub-parameter to the name of the font (see the bold stuff in Listing 9).

  2. Save the file and review the changes in your browser (see Figure 47).

  3. <FORM METHOD=POST ACTION="insert.asp">
    <TABLE BORDER=1 CELLSPACING=0 BORDERCOLOR=MAROON><TR><TD>
    <TABLE CELLSPACING=0 BORDER=0>
    <TR>
      <TD BGCOLOR=TAN>
      <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
      Name:
      </B></FONT>
      </TD>
      <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
    </TR>
    <TR>
      <TD BGCOLOR=TAN>
      <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
      E-mail:
      </B></FONT>
      </TD>
      <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
    </TR>
    <TR>
      <TD BGCOLOR=TAN></TD>
      <TD>
      <INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
      <FONT FACE="ARIAL" STYLE="font-size:9pt">
      Hide E-mail?
      </FONT>
      </TD>
    </TR>
    <TR>
      <TD BGCOLOR=TAN>
      <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
      Age:
      </B></FONT>
      </TD>
      <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
    </TR>
    <TR>
      <TD VALIGN=TOP BGCOLOR=TAN>
      <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
      Gender:
      </B></FONT>
      </TD>
      <TD>
      <INPUT TYPE=RADIO NAME=gender VALUE="male">
      <FONT FACE="ARIAL" STYLE="font-size:9pt">
      Male
      </FONT>
      <BR>
      <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>
      <FONT FACE="ARIAL" STYLE="font-size:9pt">
      Female
      </FONT>
      </TD>
    </TR>
    <TR>
      <TD VALIGN=TOP BGCOLOR=TAN>
      <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
      Comment:
      </B></FONT>
      </TD>
      <TD>
      <TEXTAREA NAME=comment ROWS=5 COLS=40 STYLE="font-family:Arial">
      Insert a Comment Here
      </TEXTAREA>
      </TD>
    </TR>
    </TABLE>
    </TD></TR></TABLE>
    <INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
    </FORM>

Listing 9 Fixing the Width of the TEXTAREA Box

Figure 47 Browser: Revised font family for the <TEXTAREA>.

That's most of what you need to do to make the form look nice. To complete the form, there are just a few more steps:

  1. Give the form a title with the following code above the first <TABLE> tag:

  2. <FONT FACE="Arial" STYLE="font-size:18pt" COLOR=MAROON>

    <B>Sign My Guest Book!</B>

    </FONT>

  3. Now we'll center the form on the screen. Add the <CENTER> tag as the first tag after the <FORM> tag, and the </CENTER> closing tag just before the </FORM> closing tag (see Listing 10).

  4. Save the file and refresh the view in your browser (see Figure 48).

Listing 10 Adding a Title and Centering the Form

<FORM METHOD=POST ACTION="insert.asp">
<CENTER>
<FONT FACE="Arial" STYLE="font-size:18pt" COLOR=MAROON>
<B>Sign My Guest Book!</B>
</FONT>
<TABLE BORDER=1 CELLSPACING=0 BORDERCOLOR=MAROON><TR><TD>
<TABLE CELLSPACING=0 BORDER=0>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Name:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=name SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  E-mail:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=email SIZE=40></TD>
</TR>
<TR>
  <TD BGCOLOR=TAN></TD>
  <TD>
  <INPUT TYPE=CHECKBOX NAME=hideEmail VALUE="yes" CHECKED>
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Hide E-mail?
  </FONT>
  </TD>
</TR>
<TR>
  <TD BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Age:
  </B></FONT>
  </TD>
  <TD><INPUT TYPE=TEXT NAME=age SIZE=3 VALUE="18"></TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Gender:
  </B></FONT>
  </TD>
  <TD>
  <INPUT TYPE=RADIO NAME=gender VALUE="male">
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Male
  </FONT>
  <BR>
  <INPUT TYPE=RADIO NAME=gender VALUE="female" CHECKED>
  <FONT FACE="ARIAL" STYLE="font-size:9pt">
  Female
  </FONT>
  </TD>
</TR>
<TR>
  <TD VALIGN=TOP BGCOLOR=TAN>
  <FONT FACE="ARIAL" STYLE="font-size:9pt"><B>
  Comment:
  </B></FONT>
  </TD>
  <TD>
  <TEXTAREA NAME=comment ROWS=5 COLS=40 STYLE="font-family:Arial">
  Insert a Comment Here
  </TEXTAREA>
  </TD>
</TR>
</TABLE>
</TD></TR></TABLE>
<INPUT TYPE=SUBMIT VALUE="SIGN MY GUESTBOOK">
</CENTER>
</FORM>

Figure 48 Browser: The form now has a title and is nicely centered.

That's it for forms! Getting good at creating forms is mainly practice, and for practice we recommend that you try creating a user registration form and a purchasing form. Both of these forms make use of all the controls we discussed and will give you plenty of practice both in laying out controls and tweaking their parameters.

The final step in your training is to learn how to create the scripts that take the information your users enter into your form, store this information in your database, and then retrieve different views of this information (see Figure 49).

Figure 49 What we'll cover in the next tutorial: Active Server Pages scripts for storing and retrieving data (see the underlined text in the figure).

The next tutorial is also the last in this series. When you've finished it off, you'll be ready to develop your own database-driven web sites.

Until then, experiment, and have fun! If you have any questions, please mail them to ProfessorF@informit.com. We'll try to answer as many as we can.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.