[http://creativecommons.org/licenses/by/3.0/]
This work is licensed under a CC
Attribution 3.0 Unported License [http://creativecommons.org/licenses/by/3.0/]
The Hypertext Markup Language (HTML) is the most important content type on the Web. Even though it is primarily intended for humans (by presenting formatted pages of textual content), it also has facets that are important for machine-based processing. HTML can be use in a variety of ways, and this lecture looks at some of the important rules that should be observed when creating HTML, for example how to use HTML markup in general and how to create accessible forms.
<form action="http://stevex.net/dump.php" method="POST" enctype="multipart/form-data"><table> <tr><td>Text:</td><td><input type="text" name="text" value="text input"/></td></tr> <tr><td>Password:</td><td><input type="password" name="password" value="hidden text"/></td></tr> <tr><td>Checkbox:</td><td><input type="checkbox" name="check" value="1"/> <input type="checkbox" name="check" value="2"/> <input type="checkbox" name="check" value="3"/></td></tr> <tr><td>Radio Button:</td><td><input type="radio" name="radio" value="1"/> <input type="radio" name="radio" value="2"/> <input type="radio" name="radio" value="3"/></td></tr> <tr><td>Submit:</td><td><input name="submit" type="submit"/></td></tr> <tr><td>File Upload:</td><td><input name="file" type="file"/></td></tr> <tr><td>Text Areas:</td><td><textarea name="textarea" rows="2" cols="20"/></td></tr> <tr><td>Selection:</td><td><select name="select"><option selected="selected">XML</option><option>SGML</option></select></td></tr> <tr><td>Multiple Selection:</td><td><select name="mselect" multiple="multiple"><option>242</option><option>290-3</option><option>290-13</option></select> </table></form>
POST
)GET
is good!GET
when implementing a formGET
encodes the values in the URIPOST
request method can upload dataPOST
sends a request containing an entityPOST
is used if the form specifies itapplication/x-www-form-urlencoded
is the default (values in the entity)multipart/form-data
is required for file upload (multipart form data)POST
requestsGET
/POST
transparentlyGET
POST
POST
with multipart/form-data
Query Parameter Test: <?php import_request_variables("gP", "form_"); echo $form_test; ?>
<tr><td>Text:</td><td><input type="text" name="text"/></td></tr> <tr><td>Password:</td><td><input type="password" name="password"/></td></tr>
<tr> <td><label for="textctrl">Text:</label></td> <td><input type="text" name="text" id="textctrl"/></td> </tr> <tr> <td><label for="pwdctrl">Password:</label></td> <td><input type="password" name="password" id="pwdctrl"/></td> </tr>
<fieldset><legend>Billing</legend>billing form controls …</fieldset> <fieldset><legend>Shipping</legend> shipping form controls … </fieldset>
Normal Control | Disabled Control | Readonly Control | |
---|---|---|---|
Text: | |||
Password: | |||
Checkbox: | ! | ||
Radio Button: | ! | ||
File Upload: | ! | ||
Text Areas: | |||
Selection: | [ not supported ] | ||
Multiple Selection: |
<P>Paragraphs often are not closed properly. <IMG WIDTH=200 HEIGHT=300 SRC="test.png"> <P>And images by definition are always empty elements.
<p>Paragraphs often are not closed properly.</p> <img width="200" height="300" src="test.png" /> <p>And images by definition are always empty elements.</p>