Multi Field Search

5 posts by 4 authors in: Forums > CMS Builder
Last Post: November 5, 2013   (RSS)

Is there a simple way to search multiple fields at once? Here is an example search form:

<form id="search" name="search" method="get" action="/search.php">
<input name="title_keyword" type="text"  />
<input type="submit" name="submit" value="Submit">
</form>

So for name, could we list multiple fields like this?

name="title_keyword,content_keyword,etc..."

Thanks

By ht1080z - November 4, 2013

Hi clicklab,

you can find information about the multisearch here:

http://www.interactivetools.com/forum/forum-posts.php?postNum=2213941#post2213941

I hope this will help,
Karls

By zip222 - November 5, 2013

Multisearch is likely overkill for your needs...

You just need to modify the form code you have slightly...

<form id="search" name="search" method="get" action="/search.php">
<input name="title,other,and_another,content_keyword" type="text"  />
<input type="submit" name="submit" value="Submit">
</form>

you can include as many fields as you want, and just you need to add "_keyword" to the final field in the list.

Special fields like dates and drop downs lists won't necessarily be searched the way you might expect.

I had tried the "title,other,and_another,content_keyword" method before but it did not work, probably because I had appended "_keyword" on every field rather than just the last one as mentioned by zip222

So thanks for all the feedback everyone - will give it a go.