Hi Folks, I appologise if this is covered. I want to set up a Search that is an AND/OR. I can adapt the present advanced search partly but I dont know the Form commands so well to get what Im after. Basically its: Keyword in Title(free text), AND/OR City(free text), AND/OR Country(freetext or selector), AND/OR Category(from list) I want to allow the user to leave any of the entry fileds Blank. Once I have the logic, I may add or substitute other fields. So, I dont need the dropdowns of Must include, exclude etc.
Can someone suggest a barebones code block that I can mess with. Thanks & Regards
<form action="search.php?action=filter&filled=1&whichtype=links" method="post"> Find listings where the title contains any of the keywords <input type="hidden" name="titlecondition" value="or" > <input type="text" size="{STANDARDSIZE}" name="titlesearch" > and the city is <input type="hidden" name="citycondition" value="=" > <input type="text" size="{STANDARDSIZE}" name="citysearch" > and the country is <input type="hidden" name="countrycondition" value="=" > <select name="countrysearch"><option value="">all</option>{COUNTRYOPS}</select> and it's in the category <select multiple="multiple" name="incatid[]" size="8">{CATOPTIONS}</select> <input type="submit" value="Search" /> </form>
Hi Paul, thank you, this comes very close & I can use it for now. Ideally it would be great to be an AND/OR as well for the category - that way a user can choose to seach with or without category to get a "site wide" search". Let me know if this is a custom job. BTW -Is there a way to "reset" the form? Regards
They could just not select any categories to do a sitewide search, or you can add <option value="">all categories</option> in that selector. For a reset button, use <input type="reset" />
Comments on Search Keyword and/or Category
Beginner
Usergroup: Customer
Joined: Nov 07, 2011
Total Topics: 1
Total Comments: 7
Posted Nov 07, 2011 - 7:56 AM:
Hi Folks, I appologise if this is covered.
I want to set up a Search that is an AND/OR. I can adapt the present advanced search partly but I dont know the Form commands so well to get what Im after.
Basically its:
Keyword in Title(free text), AND/OR City(free text), AND/OR Country(freetext or selector), AND/OR Category(from list)
I want to allow the user to leave any of the entry fileds Blank. Once I have the logic, I may add or substitute other fields. So, I dont need the dropdowns of Must include, exclude etc.
Can someone suggest a barebones code block that I can mess with.
Thanks & Regards
Beginner
Usergroup: Customer
Joined: Nov 07, 2011
Total Topics: 1
Total Comments: 7
Hi again - This is what I have - but it doesnt work properly :
Thanks.
<div class="center">
<form action="search.php?filled=1&condition={DEFAULTSEARCHTYPE}" method="post">
<input type="hidden" name="whichtype" value="links" >Search for <input type="text" name="search" size="{STANDARDSIZE}" >
<Br>
<input type="text" name="search" size="30">
<select name="country"><option value="links">Country</option><option value="all">search all</option></select>
<BR>
in <select name="incat"><option value="">All Categories</option>{CATOPTIONS}</select>
<button type="submit" class="gobutton"><img src="{IMAGESURL}/search.png" > Search</button></form></div>
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
The keyword is from the title only? In that case scratch what I said before, an advanced search form should be able to do it, will post it shortly.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Try this:
Beginner
Usergroup: Customer
Joined: Nov 07, 2011
Total Topics: 1
Total Comments: 7
Hi Paul, thank you, this comes very close & I can use it for now.
Ideally it would be great to be an AND/OR as well for the category - that way a user can choose to seach with or without category to get a "site wide" search".
Let me know if this is a custom job.
BTW -Is there a way to "reset" the form?
Regards
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
They could just not select any categories to do a sitewide search, or you can add <option value="">all categories</option> in that selector. For a reset button, use <input type="reset" />
Beginner
Usergroup: Customer
Joined: Nov 07, 2011
Total Topics: 1
Total Comments: 7
Hi Paul, Great, thanks for the help, much appreciated.
Regards