Home > Tutorials > HTML > Forms

Forms

Now that the majority of our content is added to the page, we need to consider a feedback form. To do this, we can use the following elements:

<form>
Indicates you are using a form. Requires the action attribute, which is the location of the script to be run when the form is submitted, and the method attribute, which tells the browser how the data will be submitted - GET or POST (see the PHP tutorial for details on these).
<input>
Use this tag to make a field for the user to input data. Use the type attribute to specify the input type:
  • text
  • checkbox
  • radio
  • password
  • hidden
  • submit
  • reset
  • button
  • file
  • image
Use the value attribute to specify an initial value (or, in the case of submit or button types, label the input).
<textarea>
Used to specify a larger text area for the user to input data. Requires the name,cols, and rows attributes.
<select>
Used for selecting item(s) from a list. To allow multiple selections, add the multiple keyword.
<option>
An selectable item within the select element.
<fieldset>
Used to group related form items together.
<legend>
Used with fieldset, provides a title for a given fieldset

Excercise: Open "MyFirstPage.html". Add a feedback form to the bottom of the page. Don't worry about the action attribute of the form, just set it to '#'.

If your code looks like mine, you've succeeded, and can go on to another lesson.

<<Previous

Comment on this page:

Your information Name:
Email:
Hide Email?
Enter the 5 characters shown.
Request another image.
Prove your human:
Comments Overall page rating:

Comments

No one has commented on this lesson yet. You can be the first!