Question: I have designed a website in php language. I have a search box in my website. Now i want to make it usable means that if a user wants to search anything he could just type there and can get the desired result. Is this necessary to use php or it could be happened easily with HTML tags???

Answer: 
Easiest is to add Google (or another search engine) site search. You won't need PHP, but a bit of HTML is needed. 

[Google Site Search](http://www.google.com/cse/)

While google site search is the easiest solution you can also use your own PHP search solution or use a 3rd party script such as this one

[3rd party search spider script](http://www.hotscripts.com/listing/zoom-search-engine-add-search-to-your-site-php/) (I haven't used it myself nor affiliated, it's an example of a type of script that you might find on the interweb and not a recommendation)
**this is the php code for a searchbar** 

 HOME

 html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, input, textarea, fieldset, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin:0; padding:0; border:0; outline:0; }

```
$keyword=trim($_POST["keyword"]); 

//check if the keyword is empty 

if($keyword==""){ 

echo"no keywords"; 

exit; 

} 

//With above, you can give hints to your users when they forget to enter a keyword. Now let's go through all the files or articles in your website. 

function listFiles($dir){ 

$handle=opendir($dir); 

while(false!==($file=readdir($handle))){ 

if($file!="."&&$file!=".."){ 

//if it is a directory, then continue 

if(is_dir("$dir/$file")){ 

listFiles("$dir/$file"); 

} 

else{ 

//process the searching here with the following PHP script 

} 

} 

} 

} 

//The following scripts read, process files and check whether the files contain $keyword. If $keyword is found in the file, the file address will be saved in an array-type variable. 

function listFiles($dir,$keyword,&$array){ 

$handle=opendir($dir); 

while(false!==($file=readdir($handle))){ 

if($file!="."&&$file!=".."){ 

if(is_dir("$dir/$file")){ 

listFiles("$dir/$file",$keyword,$array); 

} 

else{ 

//read file 

$data=fread(fopen("$dir/$file","r"),filesize("$dir/$file")); 

//avoid search search.php itself 

if($file!="search.php"){ 

//contain keyword? 

if(eregi("$keyword",$data)){ 

if(eregi("(.+)",$data,$m)){ 

$title=$m["1"]; 

} 

else{ 

$title="no title"; 

} 

$array[]="$dir/$file $title"; 

}

} 

} 

} 

} 

} 

//define array $array 

$array=array(); 

//execute function 

listFiles(".","php",$array); 

//echo/print search results 

foreach($array as $value){ 

list($filedir,$title)=split("[ ]",$value,"2"); 

echo "$value"."
\n"; 

}  
        ?>
hello
</body>
</html>

```