Next / Previous / Contents / TCC Help System / NM Tech homepage

14.11. The URL encoding method for forms data

When we say that the data from a form has been “URL-encoded”, it means that the data are reduced to a string of characters with this form:

For example, here is a small form with three elements.

  <form action="plants.cgi" method="post">
    <div>Description: <input type='text' name='desc'/></div>
    <div>
      Sunlight:
      <div><input type='radio' name='sun' value='full'/> Full</div>
      <div>
        <input type='radio' name='sun' value='partial'/>
        Partial sun
      </div>
      <div><input type='radio' name='sun' value='shade'/> Shade</div>
    </div>
    <div><input type='checkbox' name='toxic' value='yes'/> Toxic</div>
    <div><input type='submit'/>
  </form>

Suppose the user has typed “African violet” into the text field, set the “Shade” radiobutton, and set the “Toxic” checkbox. Three controls are considered successful, so three name/value pairs will be sent. In URL-encoded format, this would look like:

desc=African%40violet&sun=shade&toxic=yes

where the space is encoded using its hexadecimal value of “%40“ ”.