当前位置:网站首页>PHP实现搜索框的自动反查提示
PHP实现搜索框的自动反查提示
2022-08-02 03:24:00 【producing】
通过PHP连接到MySQL数据库我们可以简易查到数据并返回给页面,仅用PHP和HTML做显示数据通常最方便常用的办法就是table,但是如果需要一些更人性化的页面设计,往往会有一些页面用到jquery或者其他的前端数据处理技术,结合网上一些资料,今天做出来一个最基础的关于数据库反查并显示数据库与搜索框输入文本关联数据的提示功能(非百度搜索框的预测提示)。
echo"Show you the code:"
1、首先我们要有一个搜索界面(searchimprove.html)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Search For</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$("input").keyup(function(){
txt=$("input").val();
$.post("search.php", {suggest: txt}, function(data){
if(data.length >0) {
边栏推荐
猜你喜欢
随机推荐
Solve the problem of uni - app packaged H5 website to download image
js eventLoop 事件循环机制
js 原型和原型链
uniapp | 使用npm update更新后编译报错问题
稳定好用的短连接生成平台,支持API批量生成
js scope and closure
每日五道面试题总结 22/7/19
三元判断再三元判断
阿里云MySQL5.7安装以及部分主要问题(总和)
ES6迭代器解释举例
(2) Thinkphp6 template engine ** tag
About the apache .htaccess file of tp
IP门禁:手把手教你用PHP实现一个IP防火墙
---static page---
线程池(线程池介绍与使用)
如何计算地球上两点的距离(附公式推导)
PHP8.2中字符串变量解析的新用法
面试总结 22/7/25 面试中的重点
二维码生成API接口,可以直接作为A标签连接
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration









