当前位置:网站首页>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) {
边栏推荐
- ---static page---
- SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
- IO streams, byte stream and byte stream buffer
- What are the PHP framework?
- [symfony/mailer] An elegant and easy-to-use mail library
- 关于tp的apache 的.htaccess文件
- 项目中遇到的问题
- 如何根据地图上的两个坐标点来确定方向
- 1.8今日学习
- 1.13 学习JS
猜你喜欢
随机推荐
正则笔记(1)- 正则表达式字符匹配攻略
Stable and easy-to-use short connection generation platform, supporting API batch generation
三元判断再三元判断
The Error in the render: "TypeError: always read the properties of null '0' (reading)" Error solution
3.PHP数据类型、常量、字符串和运算符
IO流、 编码表、 字符流、 字符缓冲流
[symfony/finder]最好用的文件操作库
js 正则中 replace() 使用
微信小程序开发视频加载:[渲染层网络层错误] Failed to load media
4.14到新公司的一天
[league/flysystem] An elegant and highly supported file operation interface
查询数据库中所有表的索引,并且解析成sql
[phpunit/php-timer] A timer for code execution time
关于tp的apache 的.htaccess文件
ES6三点运算符、数组方法、字符串扩展方法
Small program van-cell line wrapping can be left-aligned
PHP有哪些杀手级超厉害框架或库或应用?
一分种一起来了解Vite的基础
Baidu positioning js API
数组的高级操作








![[sebastian/diff]一个比较两段文本的历史变化扩展库](/img/c7/ea79db7a5003523ece7cf4f39e4987.png)
