Creating a search box manually could become a a very difficult process since it requires building something that will index all your content. Most sites with search bars use one of two options:
1) Use a CMS or forum script. Almost all scripts, including WordPress and Drupal, have a search function.
2) If you prefer not to use a CMS, you can use the free Google Custom Search. This adds a Google search bar to your site and allows people to search your website with the power of Google.
http://www.google.com/cse/