Using google/search engines within a search box on your own site...easy?

I’ve got a form, just one text entry box and a button, much like google.

How do I make it so when a term is entered into the box it’ll then search google (or other sites which I know the search URL)?

The search term for google UK is,

http://www.google.co.uk/search?q=

So if my form text field is called ‘searchAlgo’ can I just append it to the URL in a frame and somehow load

http://www.google.co.uk/search?q= & searchAlgo

So if searchAlgo = “really cool stuff” it’ll output this url:

http://www.google.co.uk/search?q=really cool stuff

?

(I’m not bothered for now about adding %20/+ marks or anything, it should work, albeit badly, without them.

thanks in advance,

(edit: sorry if this is a very basic,lame question! :()

Havent tried this, but couldnt you create a form and name the textfield ‘q’ and then have the action be set to http://www.google.co.uk/search. Obviously if that doesnt work, use the onClick function of your button and redirect them to the google site with the value in the textfield…Many ways you could do this…

yes mate, I did that and it works fine :slight_smile:

the only problem is now, I need to make it so I can use one variable and pass it to multiple search engines, of which use different identifiers (like ‘q’ for google). Then the results can be displayed in frames/tabs/iframe, like the popular multiple torrent sites out there…

thanks for your time,

well you would need to setup the form the second way i mentioned. when they click ‘Search’ you need to do a ‘<your google frame>.src = <google search>?q=<text val>; <your yahoo frame>.src = <yahoo search>?<param>=<text val>;’

hth :beer:

thanks again mate, I understood your theory but I wasn’t sure what language it was in… :slight_smile:

I copped out and made it in flash as I needed it quickly. The only problem is now i’m calling a frame with javascript and it’s not loading in the right one, or with this code, anything:

searchURL = “javascript:window.frame[‘lowerframe’].location.href="” + txtQry + “"”

which outputs:

frames[‘lowerframe’].window.location=“ssss - Google Search

but it wont load in my frame named ‘lowerframe’ :frowning:

any idea why?

does any know how to get this to work on as3?
i got it to work when running the swf alone,
but once i embeded to html, it’s broken…