Jump to content

Recommended Posts

Hello,all

Recently I saw many website embedded google search to it's site.I want to do it too.But,the question is I just want to embed google to my site so people can search google from my site,but if people want to search only about my site I've already make the search form for it.

Can I use 2 type of search in my site?I've already googled it and the one I found is using google to search both (google and site) .can anyone help me?

Link to comment
https://forums.phpfreaks.com/topic/88704-helpadd-google-to-my-site/
Share on other sites

I just want to embed google search to my web so people can search with google from my web.It's like get google form to my site and after I click search it open google with search result.

But if people want to search all about my site example like product or forum,I want to use my search script.

Can it be done?I've tried to search it and the one I found is by get the search term then use

header("Location:http://www.google.com/search?hl=en&q=my+search+term")

but it failed.It just open google without the search term.

 

 

What you are looking for is really simple. It is actually a part of Google Adsense. If you don't have it sign up and you will be able to get the code that is called Adsense for search. It will allow users to search google within just your site or the web. What is nice is if they search the web with it you will get paid. Just sign up and then you just enter all your information and it will give you the code to embed in your site. You can go directly to Adsense and get started and just click on Adsense for Search.

 

https://www.google.com/adsense/static/en_US/WsOverview.html

 

 

 

 

i believe this is what you are looking for?

 

<!-- Search Google -->
<FORM method=GET action="http://www.google.com/search">
<INPUT TYPE=text name=q size=20 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="Search">
</FORM>
<!-- Search Google -->

and of course if you want the google logo

|

<!-- Search Google --><img src="www.google.com/logos/(get your image here http://www.google.com/stickers.html).gif"><br>
<FORM method=GET action="http://www.google.com/search">
<INPUT TYPE=text name=q size=20 maxlength=255 value="">
<INPUT type=submit name=btnG VALUE="Search">
</FORM>
<!-- Search Google -->

 

that code is suprisingly difficlut to come by now as google is constantly changing coeds but here you go still works

@blueman378

thanks blueman,but that is not what i'm looking for because in my logic the form action I have to use other php file,such as searchresult.php and then in searchresult.php I will divide using If,so If the user choose google,I will leave the search to google

but if the user choose search my site,I will use query from my database.

Still,thank you for your response. :D

 

I think I will try @Dada78 solution first.Hope I can get the code so I can embed it in my code

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.