Html/Training/Form

From W3C Wiki
< Html‎ | Training

Forms

<form>
<table>
  <tr>
    <td>First name</td>
    <td><input type="text" id="fn"></td>
  </tr>
  <tr>
    <td>Last name</td>
    <td><input type="text" id="ln"></td>
  </tr>
  <tr>
    <td>Gender</td>
    <td>
      <input type="radio" id="m" name="gender">male<br/>
      <input type="radio" id="f" name="gender">female
    </td>
  </tr>
  <tr>
    <td>Phone number</td>
    <td><input type="tel" id="tel"></td>
  </tr>
  <tr>
    <td>E-mail</td>
    <td><input type="email" id="email"></td>
  </tr>
  <tr>
    <td>Kind of contact</td>
    <td>
      <select>
        <option value="ir">Interview Request</option>
        <option value="mq">Membership Questions</option>
        <option value="ilq">International Liaison Questions</option>
        <option value="tq">Technology Questions</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>Comment</td>
    <td><textarea></textarea></td>
  </tr>
</table>
</form>


User-submittable form

User-submittable form is specified by <form>.
The form is used to pass data to a server.

The action attribute

The server of the destination is specified by the action attribute.

 <form action="http://www.example.com/form.cgi"></form>

The method attribute

The method attribute specifies the HTTP method with which a UA is meant to associate this element for form submission.

 <form action="http://www.example.com/form.cgi" method="get"></form>

See also The form element.


Form controls

The form element can contain some form-controls:

  • input
  • textarea
  • radiobutton
  • checkbox
  • submit button
  • select menu

... etc.

Form controls are included between <form> ... </form>.


In the next content, you will learn some form controls. "Form controls"