简体   繁体   English

从php中的单个表单搜索多个字段

[英]Search Multiple Fields from a single form in php

I have the following records我有以下记录

first name    last name   id
----------    ---------   ---
John           Doe        68
Jane           Doe        69

and I have single search box.我有一个搜索框。 What I'm trying to do is a search from a single form box.我想要做的是从单个表单框中进行搜索。

For example, the user will type in the last name Doe and all instances of Doe will show up.例如,用户将在姓氏键入Doe和所有实例Doe会显示出来。

How would I go about creating a search function that will split the data and search the correct field based on the data that is based on the input.我将如何创建一个搜索功能,该功能将拆分数据并根据基于输入的数据搜索正确的字段。

Thank you谢谢

Ok, I found the solution myself and here is what I did.好的,我自己找到了解决方案,这就是我所做的。

  1. I put the search item as an array.我把搜索项作为一个数组。
  2. I put the values of the parameters in a for loop in the query我将参数的值放在查询的 for 循环中

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

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