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:
Each control's value is encoded as
Name-value pairs are separated by ampersand (
Any character in the
part that is not a
letter or digit is encoded as the three-character
hexadecimal code for the character in the ASCII
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:
where the space is encoded using its hexadecimal value of “%40“ ”.