|This article shows you how to add a simple Google search button which will let others search your site. Your site needs to be indexed by google for this to work.
All you need to do is add this code where you want the search form to be.
<form method="GET" action="http://www.google.com/search">
<input type="text" name="query" value="" size="20">
<input type="hidden" name="as_sitesearch" value="www.yoursitename.com">
<input type="submit" value="Google my site">
Replace the hidden value "www.yoursitename.com" with the name of your website where you plan on running the search.
This form will send the user's query to Google along with the name of your site. So if you typed a query like "osix", the query which will be "osix site:www.yoursitename.com". Obviously you can use this method to search something in one particular site by directly typing the query at google.com
The disadvantages of using this method are
- You need to be listed in Google's search index
- If you make some changes to a page those changes will take time to get updated in the google index and thus may not show up in the search results.
- Google at some point of time may choose not to index your site.
Hope this was of some use.