Hi Joe. I may be able to help you on this one. Using form code in a text widget, I placed a custom search box on my blog.
It allows visitors to enter a search term, then searches Twitter traffic for those terms within a 15-mile radius of Bloomington, Indiana.
First, I had to get the url format of the search engine results. (It looks like you have this already in your post.)
Next, I added this form in a text widget to my blog:
Code:
<form name="form" target="_new" method="get" action="http://lafleurphoto.com/btweets.php">
<b>Search Bloomington Twitter traffic:</b><br />
<input name="btweets" type="text" /> <input type="submit" name="submit" value="Go" />
</form>
The last step was to create the PHP file that outputs the search in a new window, and save it in my directory as
btweets.php:
Code:
<?php
if (isset($_GET['btweets']))
{
$search = $_GET['btweets'];
echo "<meta http-equiv=\"Refresh\" content=\"0; url=http://search.twitter.com/search?q=" . $search . "+near%3A%22Bloomington%2C+Indiana%22+within%3A15mi\">";
}
else
{
echo "You need to enter a search term";
}
?>
You can see it in action at the bottom of
http://lafleurphoto.com/?p=118 . I'm certain this would work for your needs once you change the url in the PHP file. Note that you are passing 'btweets' from the form to the PHP function, so if you want to change it to another word, you have to change it throughout the PHP file as well. Hope this helps!
Michael LaFleur
www.lafleurphoto.com