0

Is it possible to get a single search bar to execute multiple values at once? For instance, let's say I have set my value="search" upon a user hitting submit, but instead of just fulfilling that one action, I would like it to fulfill multiple ones.

Take for example the code below:

<div id="search"> 
<form action="" method="get">   
<label>   
Search   
<input type="text" name="q" id="searchbox" />   
<input type="submit" name="submit" id="submit" value="Search Library" />   
</label> 
</form> 
</div> 

As you can see the value is set to execute solely what I have listed. If I wanted multiple searches to be executed would I be able to do something like the following: value="Search Library", "Search Store", "Search Stock" so that I could execute multiple searches at once, or is there another way to get this done.

By the way, I'm a bit of a novice, so step-by-step help would be appreciated.

Thanks for the help,

DCTechSU

DCTechSU
  • 1
  • 1
  • 2

1 Answers1

0

No you cant add multiple values. The way to do this is to trigger your search function and include there your seach values to your search_query or multiple queries if needed .Then you can construct an output that echoes out all the results from your queries .

For example. You are Seaching for shoes. If this item was in your library , store and stock you would get 3 results. If this item isnt in 1 of the 3 you would get only 2 and so on.

This is the way i do it with php and mysql

Alexander
  • 171
  • 2
  • 10
  • Thanks for your help, Alexander. So are you suggesting something like the following: value = "search", value = "search library", value = "search stock", value = "search stock"? – DCTechSU Feb 15 '12 at 16:25
  • nope:-) ..Ok im gonna give a very basic idea. Say you have one database only this would be your mysql search – Alexander Feb 15 '12 at 16:28
  • nope:-) ..Ok im gonna give a very basic idea. Say you have one database only. This would be your mysql search 'mysql_query("SELECT FROM yourdb WHERE library LIKE '$search_term'")' you make another 2 queris like this but where you have library you replace it with shop and then stock – Alexander Feb 15 '12 at 16:36
  • Oh, I see. I really do appreciate your help. I know I'm probably annoying you by now, but I do have another question. What if I don't want to search a database, what if I want to search content from a number of different sites, like tweets from twitter, and photos from flickr with one search bar, and one submit button? – DCTechSU Feb 15 '12 at 17:20
  • The only way you can do that is adding an external search API (searchbox)I sejject you add google seach API . You will be able from your site to search the whole web ....her is a link that will help you understand http://www.askdavetaylor.com/how_can_i_add_a_google_search_box_to_my_web_site.html – Alexander Feb 15 '12 at 18:08
  • Thank you.Unfortunatly i am at the other side of the world (Greece) :-) I hope you succeed on your project – Alexander Feb 15 '12 at 18:52