Process the results : Form « Form « PHP

Process the results

    <title>Building a Form</title>
$search = htmlentities($_GET["search"]);
$self = htmlentities($_SERVER['PHP_SELF']);
if ($search ==='' ){

    echo ('
    <form action="'.$self.'" method="GET">
        <label>Search: <input type="text" name="search" /></label>
        <input type="submit" value="Go!" />
else {
    echo "The search string is: <strong>$search</string>";

Related examples in the same category

1.print a radio button or checkbox
2.print a select menu
3.print a submit button
4.print a text box
5.print a textarea
6.HTML elements for use in forms
7.HTML Form Elements
8.HTML form for submitting data
9.Working with Multipage Forms