Ads

Your own Google search

Using this tutorial, you will learn how to create your own Google search bar for your website. You can personalize it however you would like. Take a look below!

First off we're going to start with the html code.


CODE
<form action="gsearch.php" method="post">
<input type="text" name="search" />

<input type="submit" value="Search!" />
</form>



Now put that on your website or whever you want the search box to appear on the page.

Then make a new file called gsearch.php or whatever you specified in the html code & add this code.


CODE
<?php

$address 
"www.yourwebsite.com";

$search $_POST['search'];
$search str_replace(" ","+",$search);
$search stripslashes($search);

header("Location: http://www.google.com/search?q=site%3A$address+%22$search%22&btnG=Google+Search");

?> 



Now Run your html code and search to your hearts content!
I do not take any credit for this code, due to it being used in various sources of the internet.

So please do not comment saying, you ripper or whatnot.

Sunday May 27, 2007 - 206 reads