Creating Forms for your Web Pages

If you are impatient you may see some examples of forms. PLEASE read this document even if you are ready to get it done. There is a lot of useful information here that will help you write good forms. Remember, you can always look at someone else's HTML source to see how they did it.

To create a from you simply need to include the FORM tags in your HTML document. Here is the basic format for the form section of the HTML document :

<form method="post" action="mailto:me2@psu.edu?subject=Website Feedback" enctype="text/plain" name="Some Feedback">
...
Your input tags here
...
</form>

These input tags should be of the form :
<input name="varible name" type="input type" value="default value">

example form, just change the email and items on this(look at the code)

variable name can be any word with no spaces in it. The variable name you choose will be included in the e-mail message you receive with the information that was typed into the HTML form. There are some variables that the script recognizes as commands, a few of these are required.

Variable Names

Required

Input Types

Special Note -- Every form must have a <INPUT type="submit" value="some words"> for the form to be processed. A user must click on the button it creates in order 'submit' the form.

Additional Options

Here are some additional options besides name= and type= for the INPUT HTML tag.

Other types of input

The SELECT Tag

Inside <FORM> ... </FORM>, any number of SELECT tags are allowed, freely intermixed with other HTML elements (including INPUT and TEXTAREA elements) and text (but not additional forms).

Unlike INPUT, SELECT has both opening and closing tags. Inside SELECT, only a sequence of OPTION tags -- each followed by an arbitrary amount of plain text (no HTML markup) -- is allowed; for example:

      <SELECT NAME="a-menu">
      <OPTION value="first option">First option.</OPTION>
      <OPTION value="second option">Second option.</OPTION>
      </SELECT>

The attributes to SELECT are as follows:

The attributes to OPTION are as follows:

The TEXTAREA Tag

The TEXTAREA tag can be used to place a multiline text entry field with optional default contents in a fill-out form. The attributes to TEXTAREA are as follows:

TEXTAREA fields automatically have scrollbars; any amount of text can be entered in them.

The TEXTAREA element requires both an opening and a closing tag. A TEXTAREA with no default contents looks like this:

<TEXTAREA NAME="comments" ROWS=4 COLS=40></TEXTAREA>

A TEXTAREA with default contents looks like this:

 

<TEXTAREA NAME="comments" ROWS=4 COLS=40> Default contents go here. </TEXTAREA>

Newlines are respected (so in the above example there will be a newline both before and after "Default contents go here.").

More information on Form Tags