简体   繁体   English

如何创建具有多个值的单框搜索表单

[英]how do i create a single box search form with multiple values

OK, I have a real estate site, and I would like to create a single box search form that would allow the user to enter either city/state, or address, or price, or multiple search options, etc all in this one field and then of course it would return the results......sort of like the zillow or trulia search box. 好的,我有一个房地产网站,我想创建一个单框搜索表单,该表单允许用户在该字段中输入城市/州,地址,价格或多个搜索选项等。那么它当然会返回结果……有点像zillow或trulia搜索框。 I know how to create a standard form where where there are multiple fields for each type of data, but can anyone point me in the right direction for a single box that a user can input different search terms? 我知道如何创建标准格式,其中每种数据类型都有多个字段,但是有人可以为我提供一个方向,让用户可以输入不同的搜索词的单个框吗?

Your search query has to combine the criteria using OR condition: 您的搜索查询必须使用OR条件组合条件:

WHERE city=<search_term> or 
state=<search_term> or 
price between <search_term>-1000 and <search_term>+1000

and so on. 等等。 Of course, ranking your query results by relevance is another story. 当然,按相关性对查询结果进行排名是另一回事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM