HTML and CSS Reference
In-Depth Information
<p><label for=”age”><b> Age: </label></b><br />
<input name=”age” /></p>
<p><b> Toys: </b><br />
<label><input type=”checkbox” name=”toys[]” value=”digicam” /> Digital
Camera </label><br />
<label><input type=”checkbox” name=”toys[]” value=”mp3” /> MP3 Player </label><br
/>
<label><input type=”checkbox” name=”toys[]” value=”wlan” /> Wireless
LAN </label></p>
<p><input type=”submit” value=”register” /></p>
</form>
</body>
</html>
.
Output
FIGURE 21.1
A simple user reg-
istration form.
As you can see, the form has three fields: one for the user's name, one for the user's age,
and one that enables the user to select some toys he or she owns. All three of the fields
are required. The form submits to itself, using the POST method. I've specified the action
for the form using a built-in PHP variable that returns the URL for the page currently
being displayed. That way I can make sure the form is submitted to itself without includ-
ing the URL for the page in my HTML. Here's the basic structure of the page:
<?php
// Form processing code
?>
<html>
<head>
<title> Page Structure </title>
<style type=”text/css”>
/* Page styles go here. */
</style>
21
Search WWH ::




Custom Search