<!-- search form where $q is GET passed by the search input field -->
<html>
<head>
<!-- escape for title appearing in browser; handle Microsoft Smart Quotes document-wide -->
<title><?php echo ($q) ? $q:'' ?> Example.com Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- urlencode -->
<link rel="canonical" href="http://example.com<?php echo ($q) ? '?q=' . $q:'' ?>" />
<!-- escape -->
<meta name="description" content="Example.com Search: <?php echo ($q) ? $q:'' ?>" />
<!-- parsed keywords for "phrase one" "keyword1" "keyword2" with quotes, spaces pluses and minuses etc properly escaped -->
<meta name="keywords" content="<?php echo ($phrasesCsv) ? $phrasesCsv:'' ?>" />
</head>
<body>
<h1>Example.com Search: <?php echo ($q) ? $q:'' ?></h1>
<!-- escape for url and link of suggested term -->
<?php if($suggestion) : ?>
<p>Did you mean to search for <a href="http://example.com/?q=<?php echo $suggestion?>"><?php echo $suggestion ?></a>?</p>
<?php endif;?>
<form action="http://example.com/" method="GET" accept-charset="UTF-8"><!-- note accept-charset doesn't work properly in IE -->
Search:
<input type="text" name="q" value="<?php echo ($q) ? $q:'' ?>" />
</form>
<!-- pagination, would be more complex in real life of course -->
<a href="http://example.com/?q=<?php echo ($q) ? $q:'' ?>&page=<?php echo $page ?>">2</a>
</body>
</html>