Process the results : Form « Form « PHP






Process the results

 
<html>
<head>
    <title>Building a Form</title>
</head>
<body>
<?php
$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!" />
    </form>');
}
else {
    echo "The search string is: <strong>$search</string>";
}
?>
</body>
</html>
  
  








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