Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7: FORMS > EXAMPLE

EXAMPLE

FORMS

This example shows a feedback and newsletter sign-up form. It uses a variety of form controls.

The <form> element uses the action attribute to indicate the page that the data is being sent to. Each of the form controls sits inside the <form> element. Different types of form control are suited to collecting different types of data. The <fieldset> element is used to group related questions together. The <label> element indicates the purpose of each form control.


<html>
  <head>
    <title>Forms</title>
  </head>
  <body>
    <form action=“http://www.example.com/review.php” method=“get”>
      <fieldset>
        <legend>
          Your Details:
        </legend>
        <label>
          Name:
          <input type=“text” name=“name” size=“30” maxlength=“100”>
        </label>
        <br />
        <label>
          Email:
          <input type=“email” name=“email” size=“30” maxlength=“100”>
        </label>
        <br />
      </fieldset>
      <br />
      <fieldset>
        <legend>
          Your Review:
        </legend>
        <p>
          <label for=“hear-about”>
            How did you hear about us?
          </label>
          <select name=“referrer” id=“hear-about”>
            <opt....

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial