HTML and CSS Reference
In-Depth Information
$_POST['toys'])) { echo 'checked=”checked” '; } ?>
value=”<?= $key ?>” /> <?= $value ?></label><br />
<?php } ?>
</p>
<p><input type=”submit” value=”register” /></p>
</form>
</body>
</html>
.
Output
FIGURE 21.2
A form with some
errors that were
caught during vali-
dation.
Using PHP Includes
PHP and all other server-side scripting languages provide the ability to include snippets
of code or markup in pages. With PHP, the ability to include files is built into the lan-
guage. Because the include statements are part of the language, you don't need to include
parentheses around the name of the file to be included. You can conditionally include
files, specify which file to include dynamically, or even nest include function calls within
included pages. Here's a simple example of an include call:
include “header.php”;
On encountering that function call, PHP will try to read in and process a file named
header.php in the same directory as the current page. If it can't find this file, it will try
to find the file in each of the directories in its include path , too. The include path is a list
of directories (generally specified by the server administrator) where PHP searches for
files to include, and it's generally set for the entire server in a configuration file.
21
 
 
 
Search WWH ::




Custom Search