1. Computing

Simple Site Search

By , About.com Guide

2 of 5

The Search Form
 <h2>Search</h2> 
 <form name="search" method="post" action="<?=$PHP_SELF?>">
 Seach for: <input type="text" name="find" /> in 
 <Select NAME="field">
 <Option VALUE="fname">First Name</option>
 <Option VALUE="lname">Last Name</option>
 <Option VALUE="info">Profile</option>
 </Select>
 <input type="hidden" name="searching" value="yes" />
 <input type="submit" name="search" value="Search" />
 </form>
 
The above HTML code creates the form your users will use to search. It provides a space to enter what they are looking for, and a drop down menu where they can choose what field they are searching (first name, last name or profile.) The form sends the data back to itself using the PHP_SELF () function. This code does not go inside the <?php and ?> tags, but rather above or below them.
Related Video
Basic PHP Syntax
Search With Photo Tags in Photoshop Elements
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. PHP with MySQL
  5. php search script - php search engine - php mysql search

©2013 About.com. All rights reserved.