使用一个输入字段搜索多个站点 [英] Search Multiple sites with one input field

查看:128
本文介绍了使用一个输入字段搜索多个站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你投票的时候,你会留下评论你为什么投票的原因,这样海报就有了一个想法,他们可以如何改善他们提问的方式

所以我有一个输入字段,如下所示:

 < form action =search.php? do = processmethod =post> 
< input type =hiddenname =dovalue =process/>
< input type =hiddenname =quicksearchvalue =1/>
< input type =hiddenname =childforumsvalue =1/>
< input type =hiddenname =exactnamevalue =1/>
< input type =hiddenname =svalue =$ session [sessionhash]/>
< input type =hiddenname =securitytokenvalue =$ bbuserinfo [securitytoken]/>
< input type =textname =querytabindex =1001id =overlay-searchclass =no-border overlay-search bg-transparentplaceholder =Search ... autocomplete =offspellcheck =false/>
< / form>

我想要完成的是可以搜索输入文字的备选按钮,例如google .com,但我没有找到解决方案这个= /



我试图让它起作用的方式就像是:

 对结果不满意? < a href =http://google.com/WHAT有没有搜索字符串/输入文字>尝试在google上搜索。< / a> 

我已经搜索过,并且找不到任何与此相关的内容,但我怀疑我是在搜索正确的事。任何帮助实现这一点将不胜感激=)

搜索我正在考虑包括:




  • Facebook

  • Google

  • 必应

  • 雅虎
  • 和更多


解决方案

简单的解决方案将获取发布的值输入字段并回显出来。在此之前,您必须在表单末尾添加一个提交按钮。

 <输入类型=submitname =submitvalue =Search/> 

然后在您的search.php文件中执行下面的操作。

 <?php 
//检查提交按钮是否被点击
if(isset($ _ POST ['submit'])) {
//然后做一些事

echo'对结果不满意< a href =http://google.com'.$_POST ['query']。 < / a>;

}
?>


how about when you down vote something you leave a comment on why you down voted so the poster has an idea how they can improve on the way they asked something

So I have an input field like so:

<form action="search.php?do=process" method="post">
 <input type="hidden" name="do" value="process" />
 <input type="hidden" name="quicksearch" value="1" />
 <input type="hidden" name="childforums" value="1" />
 <input type="hidden" name="exactname" value="1" />
 <input type="hidden" name="s" value="$session[sessionhash]" />
 <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
 <input type="text" name="query" tabindex="1001" id="overlay-search" class="no-border overlay-search bg-transparent" placeholder="Search..." autocomplete="off" spellcheck="false" />
</form>

what I'm trying to accomplish is alternative buttons that will search the text in the input on say google.com but I have had no success in finding a solution to this =/

the way I'm trying to get it to work is like:

Not happy with your results? <a href="http://google.com/WHAT EVER THERE SEARCH STRING IS/TEXT IN INPUT">Try searching on google.</a>

I have searched and searched and have found nothing related to this, although I doubt I'm searching the right thing. Any help in achieving this would be greatly appreciated =)

searches I'm considering on including:

  • Facebook
  • Google
  • Bing
  • Yahoo
  • and more

解决方案

A simple solution will be getting the value of the posted input field and just echoing out .Before that you must add a submit button at the end of your form.

<input type="submit" name="submit" value="Search"/>

And then do something like below in your search.php file.

        <?php 
            // Check if the submit button is clicked
            if(isset($_POST['submit'])) {
            // And then do something

                echo 'Not happy with your results?<a href="http://google.com'.$_POST['query'].'">Try searching on google.</a>";

            }
        ?>

这篇关于使用一个输入字段搜索多个站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆