查询的实现

1、HTML部分

<h4>搜索</h4>
<input type="search" id="search" name="search" value="<?php if($searchval){echo $searchval;} ?>">
<button id="searchid"
          onclick="funsearch('\/index.php\/Admin\/User\/select')" >搜索</button>

2、JS部分

function funsearch(basePath){
        var seaval = $("#search").val();
        window.location.href=basePath+'/search/'+seaval+'.html';
    }

3、PHP部分

$search = $_REQUEST['search']; //获取搜索的值
if($search){    //判断如果存在
            $where = "`username` like '%$search%'"; 
        }    
原文地址:https://www.cnblogs.com/finnlee/p/5041953.html