pngtest Posted June 26, 2008 Share Posted June 26, 2008 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. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 26, 2008 Share Posted June 26, 2008 Give them a dropdown menu and then handle it based on which one they choose. Quote Link to comment Share on other sites More sharing options...
pngtest Posted June 26, 2008 Author Share Posted June 26, 2008 leave this to a me to ask but i think that is my problem... Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 26, 2008 Share Posted June 26, 2008 Do you know how to handle form data in PHP? Quote Link to comment Share on other sites More sharing options...
pngtest Posted June 26, 2008 Author Share Posted June 26, 2008 yes to a database but not really how to link the search put in on my site to link to the proper site. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 26, 2008 Share Posted June 26, 2008 Can I see the code you have right now? Quote Link to comment Share on other sites More sharing options...
pngtest Posted June 26, 2008 Author Share Posted June 26, 2008 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> Quote Link to comment Share on other sites More sharing options...
pngtest Posted June 27, 2008 Author Share Posted June 27, 2008 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:tjw@uol.com.br">tjw@uol.com.br</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. Quote Link to comment Share on other sites More sharing options...
pngtest Posted June 27, 2008 Author Share Posted June 27, 2008 hey i was trying to fix this problem and got the error to go away by adding $_post['buscar'] but now the page just shows up blank Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.