问题
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:
- Bing
- Yahoo
- and more
回答1:
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>";
}
?>
来源:https://stackoverflow.com/questions/28656122/search-multiple-sites-with-one-input-field