搜索文本框的名字和姓氏 [英] Search text box for first name AND last name

查看:100
本文介绍了搜索文本框的名字和姓氏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,用户将在其中输入名字和姓氏,然后按这些参数进行搜索。我可以找到很多例子,并且已经完成了搜索功能,其中名字和姓氏是单独的文本框,但是我不知道如何解决这个问题。


我明白它会是某种连接,但我不确定如何去做(参数等)。我也很好奇如何处理用户是否输入FirstName LastName和FirstName LastName。或LastName FirstName或在文本框中。我想这将是相反的逻辑。


任何人都做过这样的事情可以提供洞察力吗?这是我到目前为止的...

I have a text box where users will enter a first and last name, and then search by those parameters. I can find plenty of examples and have done search functions where first name and last name are separate text boxes, however I am not sure how to go about this.

I understand it would be some kind of concatenation, yet I''m not sure how to go about it (Parameters, etc.). I am also curious on how to handle whether or not the user enters "FirstName LastName" or "LastName FirstName" in the text box. I suppose it would be the same logic just reversed.

Anyone ever done something like this who could provide insight? Here is what I have so far...

展开 | 选择 | Wrap | 行号

推荐答案

为何不分开输入?


Rabbit,感谢您的回复。老实说,我想知道如何执行此操作并更好地了解搜索数据库中的项目(有点像Google的搜索)。这种方法绝对不是强制性的,但只是偏好能够做到这一点。
Rabbit, thanks for replying. Honestly, I wanted to just have knowledge of how this could be performed and have a better understanding of searching for items in a database (somewhat like Google''s search). In no way is this method mandatory, however it was just a preference to be able to do it.


我会用空格分隔符分割输入并在第一个中查找各个值和姓氏字段。
I would split the input by a space delimiter and look for the individual values in the first and last name fields.


这篇关于搜索文本框的名字和姓氏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆