28.2. Sample Data

This section details the sample data used in this chapter and in Chapter 31, "Using PHP." Note that the code listed in this section is available on the book's companion Web site, but it is also listed here for immediate reference.

28.2.1. Sample Form

The following form is used in the form examples — data from this form is sent to the form handler.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <title>Sample Form</title>
  </head>
  <body>
    <form action="FORM_HANDLER" method="post">
    <table cellspacing="20">
    <tr><td>

      <!-- Text boxes -->
      <p>
      First Name: <input type="text" name="fname" id="fname" size="20" /><br />
      Last Name: <input type="text" name="lname" id="lname" size="20" />
      </p>

      <!-- Text area -->
      <p>
      Address:<br />
        <textarea name="addr" id="addr" cols="20" rows="4"></textarea>
      </p>

      <!-- Password -->
      <p>
      Password: <input type="password" name="pwd" id="pwd" size="20" />
      </p>
      </td><td>

      <!-- Select list -->
      <p>
      What product(s) are you<br />
interested in? <br /> <select name="prod" id="prod" multiple="multiple" size="4"> <option id="MB">Motherboards</option> <option id="CPU">Processors</option> <option id="Case">Cases</option> <option id="Power">Power Supplies</option> <option id="Mem">Memory</option> <option id="HD">Hard Drives</option> <option id="Periph">Peripherals</option> </select> </p> <!-- Check boxes --> <p> How should we contact you?<br /> <input type="checkbox" name="email" id="email" checked="checked" ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.