Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To Create Simple PHP Widgets

Objective:

  • Creating a simple PHP Widget, which will allow the user to reach the result page of Google! from your site.

Requirement:

  • Adobe Dreamweaver or any Open Source Editor like Aptana Studio, Amaya, etc.

Creating the form(index.htm):

<form action=“google.php” method=“get” name=“query_form”>

<input id=“search” onclick=‘value=”” ‘ name=“search” type=“text” value=“Enter the search term” />

<input id=“submit” name=“submit” type=“submit” value=“Submit” />

</form>

PHP Script(google.php):

?php
$url=”http://www.google.com/search?q=&#8221;.$_REQUEST[‘search’];//Adding the user query with the URL
header(“Location:$url”);
?>

<?PHP

$url=“http://www.google.com/search?q=&#8221;.$_REQUEST[‘search’];

header(“Location:$url”);

?>

Download the full script, here

Even you can create more Widgets just by changing the URLs. I’m mentioning few search URLs:

  • Yahoo Search : http://search.yahoo.com/search?q=
  • Live Search : http://search.live.com/results.aspx?q=
  • Youtube : http://www.youtube.com/results?search_query=
  • Answers : http://www.answers.com/topic/
  • Wikipedia : http://en.wikipedia.org/wiki/

Thanks to SachinKRaj for guiding me on this script. Do post your comments :)




This post first appeared on Welcome To ~S'moy's~ World | Knowledge Is Power, please read the originial post: here

Share the post

How To Create Simple PHP Widgets

×

Subscribe to Welcome To ~s'moy's~ World | Knowledge Is Power

Get updates delivered right to your inbox!

Thank you for your subscription

×