Jump to content

web search field add to site.


pngtest

Recommended Posts

I am wanting to put a search the web filed on the home page of the site i am building i used the walkthrough that was here on the site

http://www.askdavetaylor.com/how_can_i_add_a_google_search_box_to_my_web_site.html

 

but i has google search information in the site you are on and i want something where you can chose to search any one of a select few web search sites... like let them search dopile or yahoo, can anyone point me in the right direction.

Link to comment
https://forums.phpfreaks.com/topic/111943-web-search-field-add-to-site/
Share on other sites

the only thing i have honestly to search web sites is this html form..... but it only searchs google for what ever is type from test.com

 

<form method="get" action="http://www.google.com/search">

<input type="text"   name="q" size="31"
maxlength="255" value="" />
<input type="submit" value="Google Search" />
<input type="radio"  name="sitesearch" value="" />
The Web
<input type="radio"  name="sitesearch"
value="test.com" checked /> Ask Dave Taylor<br />

</form>

okay i found something i would like to use but i don't think i am doing it correctly.

 

the html code for the form is

<html>
<head>
<title>Multibusca - PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<small><small><font face="Verdana"> </font></small></small>
<form name="form1" method="post" action="result.php" target="blank">
  <table width="500" border="1">
    <tr>
      <td>
        <div align="center"><font face="Verdana" size="3"><b>Multi Search PHP</b></font></div>
      </td>
    </tr>
    <tr>
      <td> 
        <p> </p>
        <p><small><small><small><font face="Verdana"> 
          <input type="text" name="palavra" size="19" style="font-size: 8pt">
          </font></small></small></small> 
          <select name="buscar" style="font-size: 7pt">
            <option value="altavista">Altavista</option>
            <option value="aonde">Aonde</option>
            <option value="cade">Cade</option>
            <option value="google">Google</option>
            <option value="hotbot">HotBot</option>
            <option value="infoseek">InfoSeek</option>
            <option value="lycos">Lycos</option>
            <option value="radaruol">Radar UOL</option>
            <option value="yahoo">Yahoo !</option>
            <option value="zeek">Zeek</option>
            <option value="webcrawler">WebCrawler</option>
          </select>
          <input type="submit" value="buscar" name="buscar" style="font-size:8pt;background-color:rgb(255,255,255);color:rgb(0,0,0)">
        </p>
        <p> </p>
        </td>
    </tr>
    <tr>
      <td><font face="Verdana" size="1">Autor: Thyago James<br>
        <a href="mailto:[email protected]">[email protected]</a> </font></td>
    </tr>
  </table>
  </form>
</body>
</html>

 

and it links to this php

<?php
$urlAltavista="http://www.altavista.com/cgi-bin/query?q='".$_POST['palavra']."'&kl=XX&pg=q&Translate=on";
$urlCade="http://busca.cade.com.br/scripts/engine.exe?p1='".$_POST['palavra']."'&p2=1&p3=1&p5=10";
$urlZeek="http://busca.zeek.com.br/busca/busca.cfm?p='".$_POST['palavra']."'";
$urlYahoo="http://search.yahoo.com/bin/search?p='".$_POST['palavra']."'";
$urlHotBot="http://hotbot.lycos.com/?_v=2&RG=NA&act.search=Pesquisar&MT='".$_POST['palavra']."'";
$urlLycos="http://www.lycos.com/srch/index.html?query='".$_POST['palavra']."'&lpv=1&loc=fromlycosmain";
$urlInfoSeek="http://www.goto.com/d/search/p/go/?Partner=go_home&Keywords='".$_POST['palavra']."'&Go=Search" ;
$urlWebCrawler="http://www.webcrawler.com/cgi-bin/WebQuery?searchText='".$_POST['palavra']."'";
$urlGoogle="http://www.google.com/search?q='".$_POST['palavra']."'";
$urlRadar="http://www.radaruol.com.br/index.asp?MT='".$_POST['palavra']."'&SM=MC&LG=any&DC=10&RG=.br&_v=2&act.search.x=18&act.search.y=11";
$urlAonde="http://www.aonde.com/cgi/consulta.cgi?keys='".$_POST['palavra']."'&search_type=and&I3.x=5&I3.y=10";



Switch($buscar) {
  Case "altavista":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlAltavista'\">";
   
  Case "cade":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlCade'\">";

  Case "zeek":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlZeek'\">";

  Case "yahoo":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlYahoo'\">";
   
  Case "hotbot":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlHotBot'\">";

  Case "lycos":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlLycos'\">";

  Case "infoseek": 
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlInfoSeek'\">";

  Case "webcrawler":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlWebCrawler'\">";
   
  Case "google":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlGoogle'\">";

  Case "radaruol":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlRadar'\">";

  Case "aonde":
    echo "<META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='$urlAonde'\">";
}
?>

 

but whenever i try to search something i get an undefined variable for the buscar.  but can't fix it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.