Since you'll need a place for the user to enter a search query, let's begin by building a form to handle the user's input. Every form must have these basic components:
The submission type defined with the method keyword
One or more input elements defined with the input tag
The destination to go to when submitted defined with the action keyword
A simple form with a text input field called search and a submit button.
<html>
<head>
<title>Test a Form</title>
</head>
<body>
<form action="<?php echo($_SERVER['PHP_SELF']); ?>"
method="get">
<label>
Search: <input type="text" name="search" />
</label>
<input type="submit" value="Add" />
</form>
</body>
</html>
Strictly speaking, forms are defined purely by HTML, but we're using some
PHP code on line 6 to reference the super global PHP_SELF. This provides a
shortcut to the name of the current PHP file that handles the submission
of the form data.